From 71fe9a308b383f1f8bf760907cf28ea33ac3af6e Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sat, 27 May 2023 20:17:34 +0200 Subject: [PATCH] Fix compiler errors --- .../stratosphere/loader/source/oc/Makefile | 2 +- .../stratosphere/loader/source/oc/oc_test.cpp | 14 +++++++------- .../stratosphere/loader/source/oc/oc_test.hpp | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/Makefile b/Source/Atmosphere/stratosphere/loader/source/oc/Makefile index ec675935..c1a527b7 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/Makefile +++ b/Source/Atmosphere/stratosphere/loader/source/oc/Makefile @@ -22,7 +22,7 @@ INC_DIRS := $(shell find $(SRC_DIRS) -type d) # Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag INC_FLAGS := $(addprefix -I,$(INC_DIRS)) -CPPFLAGS := $(INC_FLAGS) -Wall -Werror -std=c++20 -Og -g +CPPFLAGS := $(INC_FLAGS) -Wall -Werror -Wno-unused-result -std=c++20 -Og -g # The final build step. $(TARGET_EXEC): $(OBJS) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.cpp index e7c601be..7b8100e3 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.cpp @@ -84,7 +84,7 @@ Result Test_PcvDvfsTable() { constexpr size_t limit = ams::ldr::oc::pcv::DvfsTableEntryLimit; cvb_entry_t customized_table[limit] = {}; - for (int i = 0; i < limit; i++) { + for (size_t i = 0; i < limit; i++) { assert(GetDvfsTableEntryCount(customized_table) == i); auto p = GetDvfsTableLastEntry(customized_table); if (p) @@ -160,8 +160,8 @@ int main(int argc, char** argv) { ams::ldr::oc::pcv::erista::Patch(reinterpret_cast(erista_buf), file_size); if (save_patched) { char* exec_path_erista = reinterpret_cast(malloc(exec_path_patched_len)); - strlcpy(exec_path_erista, exec_path, exec_path_patched_len); - strlcat(exec_path_erista, erista_ext, exec_path_patched_len); + strncpy(exec_path_erista, exec_path, exec_path_patched_len); + strncat(exec_path_erista, erista_ext, exec_path_patched_len); saveExec(exec_path_erista, erista_buf, file_size); free(exec_path_erista); } @@ -176,8 +176,8 @@ int main(int argc, char** argv) { ams::ldr::oc::pcv::mariko::Patch(reinterpret_cast(mariko_buf), file_size); if (save_patched) { char* exec_path_mariko = reinterpret_cast(malloc(exec_path_patched_len)); - strlcpy(exec_path_mariko, exec_path, exec_path_patched_len); - strlcat(exec_path_mariko, mariko_ext, exec_path_patched_len); + strncpy(exec_path_mariko, exec_path, exec_path_patched_len); + strncat(exec_path_mariko, mariko_ext, exec_path_patched_len); saveExec(exec_path_mariko, mariko_buf, file_size); free(exec_path_mariko); } @@ -193,8 +193,8 @@ int main(int argc, char** argv) { ams::ldr::oc::ptm::Patch(reinterpret_cast(mariko_buf), file_size); if (save_patched) { char* exec_path_mariko = reinterpret_cast(malloc(exec_path_patched_len)); - strlcpy(exec_path_mariko, exec_path, exec_path_patched_len); - strlcat(exec_path_mariko, mariko_ext, exec_path_patched_len); + strncpy(exec_path_mariko, exec_path, exec_path_patched_len); + strncat(exec_path_mariko, mariko_ext, exec_path_patched_len); saveExec(exec_path_mariko, mariko_buf, file_size); free(exec_path_mariko); } diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.hpp index af2f3746..32537644 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/oc_test.hpp @@ -17,6 +17,7 @@ #pragma once #ifndef ATMOSPHERE_IS_STRATOSPHERE +#include #include #include #include