[*] basic in-house cpp linting (#4039)

- add `#pragma once` to remainder files
- "correcter" defines (ANDROID), see https://groups.google.com/g/android-ndk/c/cf9_f1SLXls
- extra miscelly fixups

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4039
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
lizzie 2026-06-04 05:49:07 +02:00 committed by crueter
parent 978d9d935d
commit 89199f4d27
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
53 changed files with 176 additions and 153 deletions

View file

@ -9,7 +9,7 @@
#include "common/assert.h"
#include "common/fs/file.h"
#include "common/fs/fs.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include "common/fs/fs_android.h"
#endif
#include "common/logging.h"
@ -259,7 +259,7 @@ void IOFile::Open(const fs::path& path, FileAccessMode mode, FileType type, File
} else {
_wfopen_s(&file, path.c_str(), AccessModeToWStr(mode, type));
}
#elif ANDROID
#elif __ANDROID__
if (Android::IsContentUri(path)) {
ASSERT_MSG(mode == FileAccessMode::Read, "Content URI file access is for read-only!");
const auto fd = Android::OpenContentUri(path, Android::OpenMode::Read);
@ -396,7 +396,7 @@ u64 IOFile::GetSize() const {
// Flush any unwritten buffered data into the file prior to retrieving the file size.
std::fflush(file);
#if ANDROID
#ifdef __ANDROID__
u64 file_size = 0;
if (Android::IsContentUri(file_path)) {
file_size = Android::GetSize(file_path);

View file

@ -6,7 +6,7 @@
#include "common/fs/file.h"
#include "common/fs/fs.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include "common/fs/fs_android.h"
#endif
#include "common/fs/path_util.h"
@ -532,7 +532,7 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
bool Exists(const fs::path& path) {
std::error_code ec;
#ifdef ANDROID
#ifdef __ANDROID__
if (Android::IsContentUri(path)) {
return Android::Exists(path);
} else {
@ -545,7 +545,7 @@ bool Exists(const fs::path& path) {
bool IsFile(const fs::path& path) {
std::error_code ec;
#ifdef ANDROID
#ifdef __ANDROID__
if (Android::IsContentUri(path)) {
return !Android::IsDirectory(path);
} else {
@ -558,7 +558,7 @@ bool IsFile(const fs::path& path) {
bool IsDir(const fs::path& path) {
std::error_code ec;
#ifdef ANDROID
#ifdef __ANDROID__
if (Android::IsContentUri(path)) {
return Android::IsDirectory(path);
} else {
@ -611,7 +611,7 @@ fs::file_type GetEntryType(const fs::path& path) {
}
u64 GetSize(const fs::path& path) {
#ifdef ANDROID
#ifdef __ANDROID__
if (Android::IsContentUri(path)) {
return Android::GetSize(path);
}

View file

@ -11,7 +11,7 @@
#include "common/assert.h"
#include "common/fs/fs.h"
#ifdef ANDROID
#ifdef __ANDROID__
#include "common/fs/fs_android.h"
#endif
#include "common/fs/fs_paths.h"
@ -126,7 +126,7 @@ public:
LEGACY_PATH(Yuzu, YUZU)
LEGACY_PATH(Suyu, SUYU)
#undef LEGACY_PATH
#elif ANDROID
#elif __ANDROID__
ASSERT(!eden_path.empty());
eden_path_cache = eden_path / CACHE_DIR;
eden_path_config = eden_path / CONFIG_DIR;
@ -447,11 +447,11 @@ std::vector<std::string> SplitPathComponentsCopy(std::string_view filename) {
std::string SanitizePath(std::string_view path_, DirectorySeparator directory_separator) {
std::string path(path_);
#ifdef ANDROID
#ifdef __ANDROID__
if (Android::IsContentUri(path)) {
return path;
}
#endif // ANDROID
#endif // __ANDROID__
char type1 = directory_separator == DirectorySeparator::BackwardSlash ? '/' : '\\';
char type2 = directory_separator == DirectorySeparator::BackwardSlash ? '\\' : '/';
@ -482,7 +482,7 @@ std::string GetParentPath(std::string_view path) {
return std::string(path);
}
#ifdef ANDROID
#ifdef __ANDROID__
if (path[0] != '/') {
std::string path_string{path};
return FS::Android::GetParentDirectory(path_string);