1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 03:06:17 +00:00

libstrat: fix bugs/compiler warnings

This commit is contained in:
Michael Scire 2020-07-01 09:22:09 -07:00 committed by SciresM
parent 70e67da1e1
commit 0a53c74aad
8 changed files with 31 additions and 21 deletions

View file

@ -19,7 +19,7 @@ export ATMOSPHERE_DEFINES := -DATMOSPHERE
export ATMOSPHERE_SETTINGS := -fPIE -g
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector \
-Wno-format-truncation -Wno-format-zero-length
-Wno-format-truncation -Wno-format-zero-length -Wno-stringop-truncation
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20
export ATMOSPHERE_ASFLAGS :=

View file

@ -116,7 +116,7 @@ dist: dist-src dist-bin
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr release lib *.bz2
@rm -fr release lib *.bz2 include/stratosphere.hpp.gch
#---------------------------------------------------------------------------------
else

View file

@ -37,10 +37,10 @@ namespace ams::fs::impl {
AMS_ASSERT(out != nullptr);
switch (priority) {
case PriorityRaw_Normal: *out = TlsIoPriority_Normal;
case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime;
case PriorityRaw_Low: *out = TlsIoPriority_Low;
case PriorityRaw_Background: *out = TlsIoPriority_Background;
case PriorityRaw_Normal: *out = TlsIoPriority_Normal; break;
case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime; break;
case PriorityRaw_Low: *out = TlsIoPriority_Low; break;
case PriorityRaw_Background: *out = TlsIoPriority_Background; break;
default: return fs::ResultInvalidArgument();
}
@ -51,10 +51,10 @@ namespace ams::fs::impl {
AMS_ASSERT(out != nullptr);
switch (static_cast<TlsIoPriority>(tls_io)) {
case TlsIoPriority_Normal: *out = PriorityRaw_Normal;
case TlsIoPriority_Realtime: *out = PriorityRaw_Realtime;
case TlsIoPriority_Low: *out = PriorityRaw_Low;
case TlsIoPriority_Background: *out = PriorityRaw_Background;
case TlsIoPriority_Normal: *out = PriorityRaw_Normal; break;
case TlsIoPriority_Realtime: *out = PriorityRaw_Realtime; break;
case TlsIoPriority_Low: *out = PriorityRaw_Low; break;
case TlsIoPriority_Background: *out = PriorityRaw_Background; break;
default: return fs::ResultInvalidArgument();
}

View file

@ -98,7 +98,7 @@ namespace ams::erpt::srv {
}
s64 JournalForReports::GetMaxReportSize() {
s64 max_size;
s64 max_size = 0;
for (auto it = s_record_list.begin(); it != s_record_list.end(); it++) {
max_size = std::max(max_size, it->info.report_size);
}

View file

@ -75,6 +75,7 @@ namespace ams::erpt::srv {
auto file_guard = SCOPE_GUARD { if (mode == StreamMode_Write) { fs::CloseFile(this->file_handle); } };
std::strncpy(this->file_name, path, sizeof(this->file_name));
this->file_name[sizeof(this->file_name) - 1] = '\x00';
this->buffer = reinterpret_cast<u8 *>(Allocate(buffer_size));
R_UNLESS(this->buffer != nullptr, erpt::ResultOutOfMemory());

View file

@ -183,8 +183,8 @@ namespace ams::fs::impl {
return g_access_log_manager_printer_callback_manager;
}
const char *GetPriorityRawName() {
return fs::impl::IdString().ToString(fs::GetPriorityRawOnCurrentThreadInternal());
const char *GetPriorityRawName(fs::impl::IdString &id_string) {
return id_string.ToString(fs::GetPriorityRawOnCurrentThreadInternal());
}
Result OutputAccessLogToSdCardImpl(const char *log, size_t size) {
@ -405,28 +405,32 @@ namespace ams::fs::impl {
void OutputAccessLog(Result result, os::Tick start, os::Tick end, const char *name, fs::FileHandle handle, const char *fmt, ...) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle.handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle.handle, fmt, vl);
va_end(vl);
}
void OutputAccessLog(Result result, os::Tick start, os::Tick end, const char *name, fs::DirectoryHandle handle, const char *fmt, ...) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle.handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle.handle, fmt, vl);
va_end(vl);
}
void OutputAccessLog(Result result, os::Tick start, os::Tick end, const char *name, fs::impl::IdentifyAccessLogHandle handle, const char *fmt, ...) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle.handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle.handle, fmt, vl);
va_end(vl);
}
void OutputAccessLog(Result result, os::Tick start, os::Tick end, const char *name, const void *handle, const char *fmt, ...) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle, fmt, vl);
va_end(vl);
}
@ -441,7 +445,8 @@ namespace ams::fs::impl {
if (R_FAILED(result)) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle.handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle.handle, fmt, vl);
va_end(vl);
}
}
@ -450,7 +455,8 @@ namespace ams::fs::impl {
if (R_FAILED(result)) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle.handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle.handle, fmt, vl);
va_end(vl);
}
}
@ -459,7 +465,8 @@ namespace ams::fs::impl {
if (R_FAILED(result)) {
std::va_list vl;
va_start(vl, fmt);
OutputAccessLog(result, GetPriorityRawName(), start, end, name, handle, fmt, vl);
fs::impl::IdString id_string;
OutputAccessLog(result, GetPriorityRawName(id_string), start, end, name, handle, fmt, vl);
va_end(vl);
}
}

View file

@ -130,7 +130,7 @@ namespace ams::fs {
PriorityRaw GetPriorityRawOnCurrentThreadInternal() {
fs::PriorityRaw priority_raw;
AMS_FS_R_ABORT_UNLESS(GetPriorityRawImpl(std::addressof(priority_raw), os::GetCurrentThread()));
R_ABORT_UNLESS(GetPriorityRawImpl(std::addressof(priority_raw), os::GetCurrentThread()));
return priority_raw;
}

View file

@ -73,6 +73,8 @@ namespace ams::fssystem {
core_size = (size < buffer_round_up_difference) ? 0 : util::AlignDown(size - buffer_round_up_difference, data_alignment);
buffer_gap = buffer_round_up_difference;
offset_gap = GetRoundDownDifference(offset, data_alignment);
covered_offset = offset;
}
/* Read the core portion. */