summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/compression.cpp7
-rw-r--r--core/io/file_access_encrypted.cpp3
-rw-r--r--core/io/file_access_memory.cpp5
-rw-r--r--core/io/file_access_zip.cpp3
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/image.cpp11
-rw-r--r--core/io/marshalls.cpp16
-rw-r--r--core/io/multiplayer_api.cpp2
-rw-r--r--core/io/packed_data_container.cpp2
-rw-r--r--core/io/stream_peer.cpp4
-rw-r--r--core/io/xml_parser.cpp2
-rw-r--r--core/io/zip_io.cpp4
12 files changed, 27 insertions, 34 deletions
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 980234cbfc..6de626db99 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -32,7 +32,6 @@
#include "core/config/project_settings.h"
#include "core/io/zip_io.h"
-#include "core/os/copymem.h"
#include "thirdparty/misc/fastlz.h"
@@ -44,8 +43,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,
case MODE_FASTLZ: {
if (p_src_size < 16) {
uint8_t src[16];
- zeromem(&src[p_src_size], 16 - p_src_size);
- copymem(src, p_src, p_src_size);
+ memset(&src[p_src_size], 0, 16 - p_src_size);
+ memcpy(src, p_src, p_src_size);
return fastlz_compress(src, 16, p_dst);
} else {
return fastlz_compress(p_src, p_src_size, p_dst);
@@ -136,7 +135,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
if (p_dst_max_size < 16) {
uint8_t dst[16];
ret_size = fastlz_decompress(p_src, p_src_size, dst, 16);
- copymem(p_dst, dst, p_dst_max_size);
+ memcpy(p_dst, dst, p_dst_max_size);
} else {
ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size);
}
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 8ace897f18..13377a3a25 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -31,7 +31,6 @@
#include "file_access_encrypted.h"
#include "core/crypto/crypto_core.h"
-#include "core/os/copymem.h"
#include "core/string/print_string.h"
#include "core/variant/variant.h"
@@ -151,7 +150,7 @@ void FileAccessEncrypted::_release() {
ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
compressed.resize(len);
- zeromem(compressed.ptrw(), len);
+ memset(compressed.ptrw(), 0, len);
for (int i = 0; i < data.size(); i++) {
compressed.write[i] = data[i];
}
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index 58670d5246..af155a77a8 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -31,7 +31,6 @@
#include "file_access_memory.h"
#include "core/config/project_settings.h"
-#include "core/os/copymem.h"
#include "core/os/dir_access.h"
#include "core/templates/map.h"
@@ -149,7 +148,7 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const {
WARN_PRINT("Reading less data than requested");
}
- copymem(p_dst, &data[pos], read);
+ memcpy(p_dst, &data[pos], read);
pos += p_length;
return read;
@@ -176,6 +175,6 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
WARN_PRINT("Writing less data than requested");
}
- copymem(&data[pos], p_src, write);
+ memcpy(&data[pos], p_src, write);
pos += p_length;
}
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 586c988974..397b577612 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -32,7 +32,6 @@
#include "file_access_zip.h"
-#include "core/os/copymem.h"
#include "core/os/file_access.h"
ZipArchive *ZipArchive::instance = nullptr;
@@ -120,7 +119,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
ERR_FAIL_COND_V_MSG(!f, nullptr, "Cannot open file '" + packages[file.package].filename + "'.");
zlib_filefunc_def io;
- zeromem(&io, sizeof(io));
+ memset(&io, 0, sizeof(io));
io.opaque = f;
io.zopen_file = godot_open;
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 3863dce0f6..4b053d576c 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -633,7 +633,7 @@ PackedByteArray HTTPClient::read_response_body_chunk() {
ret.resize(chunk.size() - 2);
uint8_t *w = ret.ptrw();
- copymem(w, chunk.ptr(), chunk.size() - 2);
+ memcpy(w, chunk.ptr(), chunk.size() - 2);
chunk.clear();
}
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 873eb66f33..c36fa6e45f 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -34,7 +34,6 @@
#include "core/io/image_loader.h"
#include "core/io/resource_loader.h"
#include "core/math/math_funcs.h"
-#include "core/os/copymem.h"
#include "core/string/print_string.h"
#include "core/templates/hash_map.h"
@@ -1537,7 +1536,7 @@ void Image::shrink_x2() {
uint8_t *w = new_img.ptrw();
const uint8_t *r = data.ptr();
- copymem(w, &r[ofs], new_size);
+ memcpy(w, &r[ofs], new_size);
}
width = MAX(width / 2, 1);
@@ -1932,7 +1931,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con
uint8_t* wr = imgdata.ptrw();
- copymem(wr.ptr(), ptr, size);
+ memcpy(wr.ptr(), ptr, size);
wr = uint8_t*();
Ref<Image> im;
im.instance();
@@ -1982,7 +1981,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma
{
uint8_t *w = data.ptrw();
- zeromem(w, size);
+ memset(w, 0, size);
}
width = p_width;
@@ -3295,7 +3294,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const {
{
uint8_t *wr = new_data.ptrw();
const uint8_t *rd = data.ptr();
- copymem(wr, rd + ofs, size);
+ memcpy(wr, rd + ofs, size);
}
Ref<Image> image;
@@ -3622,5 +3621,5 @@ Ref<Resource> Image::duplicate(bool p_subresources) const {
}
void Image::set_as_black() {
- zeromem(data.ptrw(), data.size());
+ memset(data.ptrw(), 0, data.size());
}
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 218a612da2..0282609270 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -851,7 +851,7 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
if (buf) {
encode_uint32(utf8.length(), buf);
buf += 4;
- copymem(buf, utf8.get_data(), utf8.length());
+ memcpy(buf, utf8.get_data(), utf8.length());
buf += utf8.length();
}
@@ -995,7 +995,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(utf8.length(), buf);
buf += 4;
- copymem(buf, utf8.get_data(), utf8.length());
+ memcpy(buf, utf8.get_data(), utf8.length());
buf += pad + utf8.length();
}
@@ -1079,7 +1079,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
Transform2D val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
- copymem(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float));
+ memcpy(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float));
}
}
}
@@ -1130,7 +1130,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
Basis val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
- copymem(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float));
+ memcpy(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float));
}
}
}
@@ -1143,7 +1143,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
Transform val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
- copymem(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
+ memcpy(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
}
}
@@ -1258,7 +1258,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(utf8.length()+1,buf);
buf+=4;
- copymem(buf,utf8.get_data(),utf8.length()+1);
+ memcpy(buf,utf8.get_data(),utf8.length()+1);
}
r_len+=4+utf8.length()+1;
@@ -1314,7 +1314,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
encode_uint32(datalen, buf);
buf += 4;
const uint8_t *r = data.ptr();
- copymem(buf, &r[0], datalen * datasize);
+ memcpy(buf, &r[0], datalen * datasize);
buf += datalen * datasize;
}
@@ -1412,7 +1412,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(utf8.length() + 1, buf);
buf += 4;
- copymem(buf, utf8.get_data(), utf8.length() + 1);
+ memcpy(buf, utf8.get_data(), utf8.length() + 1);
buf += utf8.length() + 1;
}
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 94060cfe0b..8414ee7c0c 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -897,7 +897,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
// Special optimization when only the byte vector is sent.
const Vector<uint8_t> data = *p_arg[0];
MAKE_ROOM(ofs + data.size());
- copymem(&(packet_cache.write[ofs]), data.ptr(), sizeof(uint8_t) * data.size());
+ memcpy(&(packet_cache.write[ofs]), data.ptr(), sizeof(uint8_t) * data.size());
ofs += data.size();
} else {
// Arguments
diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp
index a0b97772e6..c6354b11b7 100644
--- a/core/io/packed_data_container.cpp
+++ b/core/io/packed_data_container.cpp
@@ -317,7 +317,7 @@ Error PackedDataContainer::pack(const Variant &p_data) {
datalen = tmpdata.size();
data.resize(tmpdata.size());
uint8_t *w = data.ptrw();
- copymem(w, tmpdata.ptr(), tmpdata.size());
+ memcpy(w, tmpdata.ptr(), tmpdata.size());
return OK;
}
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 8407d55196..74154321b3 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -433,7 +433,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) {
}
uint8_t *w = data.ptrw();
- copymem(&w[pointer], p_data, p_bytes);
+ memcpy(&w[pointer], p_data, p_bytes);
pointer += p_bytes;
return OK;
@@ -466,7 +466,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_
}
const uint8_t *r = data.ptr();
- copymem(p_buffer, r + pointer, r_received);
+ memcpy(p_buffer, r + pointer, r_received);
pointer += r_received;
// FIXME: return what? OK or ERR_*
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index d5eb32513b..a1f8e79adc 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -433,7 +433,7 @@ Error XMLParser::open_buffer(const Vector<uint8_t> &p_buffer) {
length = p_buffer.size();
data = memnew_arr(char, length + 1);
- copymem(data, p_buffer.ptr(), length);
+ memcpy(data, p_buffer.ptr(), length);
data[length] = 0;
P = data;
return OK;
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp
index 4b4a46e198..fe46868dd0 100644
--- a/core/io/zip_io.cpp
+++ b/core/io/zip_io.cpp
@@ -30,8 +30,6 @@
#include "zip_io.h"
-#include "core/os/copymem.h"
-
void *zipio_open(void *data, const char *p_fname, int mode) {
FileAccess *&f = *(FileAccess **)data;
@@ -103,7 +101,7 @@ int zipio_testerror(voidpf opaque, voidpf stream) {
voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
voidpf ptr = memalloc(items * size);
- zeromem(ptr, items * size);
+ memset(ptr, 0, items * size);
return ptr;
}