From eb8bad55ee2f8aeec6a8a2dbdd5085ab699849a5 Mon Sep 17 00:00:00 2001 From: Timerix Date: Fri, 8 Aug 2025 21:39:16 +0300 Subject: [PATCH] enabled additional compiler errors --- dependencies/tlibc | 2 +- project.config | 4 ++-- src/cryptography/AES.c | 12 ++++++------ src/network/socket.c | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dependencies/tlibc b/dependencies/tlibc index 223406d..fe9e44a 160000 --- a/dependencies/tlibc +++ b/dependencies/tlibc @@ -1 +1 @@ -Subproject commit 223406d4e45503318b197bd069d8f75335fee64f +Subproject commit fe9e44a660e23c28255ba27522d15ab94044f55b diff --git a/project.config b/project.config index d8bcf2f..2d4d76f 100644 --- a/project.config +++ b/project.config @@ -6,8 +6,8 @@ CMP_C="gcc" CMP_CPP="g++" STD_C="c99" STD_CPP="c++11" -WARN_C="-Wall -Wextra -Wno-unused-parameter" -WARN_CPP="-Wall -Wextra -Wno-unused-parameter" +WARN_C="-Wall -Wextra -Werror=return-type -Werror=pointer-arith -Wno-unused-parameter" +WARN_CPP="-Wall -Wextra -Werror=return-type -Werror=pointer-arith -Wno-unused-parameter" SRC_C="$(find src -name '*.c')" #SRC_CPP="$(find src -name '*.cpp')" diff --git a/src/cryptography/AES.c b/src/cryptography/AES.c index 6f8e199..36f22a1 100755 --- a/src/cryptography/AES.c +++ b/src/cryptography/AES.c @@ -28,17 +28,17 @@ void EncryptorAES_encrypt(EncryptorAES* ptr, Array(u8) src, Array(u8) dst){ br_aes_ct64_cbcenc_run(&ptr->enc_ctx, ptr->iv, ptr->buf, header_size); // write encrypted header to dst memcpy(dst.data, ptr->buf, header_size); - dst.data += header_size; + dst.data = (u8*)dst.data + header_size; dst.size -= header_size; // write full blocks while(src.size > __AES_BUFFER_SIZE){ memcpy(ptr->buf, src.data, __AES_BUFFER_SIZE); - src.data += __AES_BUFFER_SIZE; + src.data = (u8*)src.data + __AES_BUFFER_SIZE; src.size -= __AES_BUFFER_SIZE; br_aes_ct64_cbcenc_run(&ptr->enc_ctx, ptr->iv, ptr->buf, __AES_BUFFER_SIZE); memcpy(dst.data, ptr->buf, __AES_BUFFER_SIZE); - dst.data += __AES_BUFFER_SIZE; + dst.data = (u8*)dst.data + __AES_BUFFER_SIZE; dst.size -= __AES_BUFFER_SIZE; } @@ -66,7 +66,7 @@ void DecryptorAES_decrypt(DecryptorAES* ptr, Array(u8) src, Array(u8) dst, u32* // copy encrypted header from src to buffer const u32 header_size = __AES_RANDOM_BYTES_N + sizeof(EncryptedBlockInfo); memcpy(ptr->buf, src.data, header_size); - src.data += header_size; + src.data = (u8*)src.data + header_size; src.size -= header_size; // decrypt buffer br_aes_ct64_cbcdec_run(&ptr->dec_ctx, ptr->iv, &ptr->buf, header_size); @@ -78,11 +78,11 @@ void DecryptorAES_decrypt(DecryptorAES* ptr, Array(u8) src, Array(u8) dst, u32* // write full blocks while(src.size > __AES_BUFFER_SIZE){ memcpy(ptr->buf, src.data, __AES_BUFFER_SIZE); - src.data += __AES_BUFFER_SIZE; + src.data = (u8*)src.data + __AES_BUFFER_SIZE; src.size -= __AES_BUFFER_SIZE; br_aes_ct64_cbcdec_run(&ptr->dec_ctx, ptr->iv, ptr->buf, __AES_BUFFER_SIZE); memcpy(dst.data, ptr->buf, __AES_BUFFER_SIZE); - dst.data += __AES_BUFFER_SIZE; + dst.data = (u8*)dst.data + __AES_BUFFER_SIZE; dst.size -= __AES_BUFFER_SIZE; } diff --git a/src/network/socket.c b/src/network/socket.c index ab7683f..605bf4d 100755 --- a/src/network/socket.c +++ b/src/network/socket.c @@ -1,7 +1,6 @@ #include "internal.h" #include "socket.h" -#include "errno.h" -#include "assert.h" +#include Result(Socket) socket_open_TCP(){ Socket s = socket(AF_INET, SOCK_STREAM, 0);