ncm: trim trailing spaces

This commit is contained in:
Michael Scire 2020-03-03 03:49:57 -08:00
parent 7576ab3ab0
commit 10777622e2
6 changed files with 19 additions and 19 deletions

View File

@ -173,7 +173,7 @@ namespace ams::ncm::impl {
/* Set the scope for the scoped_lock. */ /* Set the scope for the scoped_lock. */
{ {
std::scoped_lock lock(this->cache_mutex); std::scoped_lock lock(this->cache_mutex);
/* If the placeholder id is invalid, return success early. */ /* If the placeholder id is invalid, return success early. */
R_UNLESS(placeholder_id != InvalidPlaceHolderId, ResultSuccess()); R_UNLESS(placeholder_id != InvalidPlaceHolderId, ResultSuccess());
@ -187,7 +187,7 @@ namespace ams::ncm::impl {
} }
this->StoreToCache(f, placeholder_id); this->StoreToCache(f, placeholder_id);
R_UNLESS(fseek(f, 0L, SEEK_END) == 0, fsdevGetLastResult()); R_UNLESS(fseek(f, 0L, SEEK_END) == 0, fsdevGetLastResult());
size_t size = ftell(f); size_t size = ftell(f);
R_UNLESS(fseek(f, 0L, SEEK_SET) == 0, fsdevGetLastResult()); R_UNLESS(fseek(f, 0L, SEEK_SET) == 0, fsdevGetLastResult());

View File

@ -36,7 +36,7 @@ namespace ams::ncm::fs {
fopen_mode = "r+b"; fopen_mode = "r+b";
} else if (mode & FsOpenMode_Read) { } else if (mode & FsOpenMode_Read) {
fopen_mode = "rb"; fopen_mode = "rb";
} }
FILE *f = fopen(path, fopen_mode); FILE *f = fopen(path, fopen_mode);
R_UNLESS(f != nullptr, fsdevGetLastResult()); R_UNLESS(f != nullptr, fsdevGetLastResult());
@ -78,7 +78,7 @@ namespace ams::ncm::fs {
} }
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
} }
return ResultSuccess(); return ResultSuccess();
} }
@ -94,7 +94,7 @@ namespace ams::ncm::fs {
} }
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
} }
return ResultSuccess(); return ResultSuccess();
} }
@ -105,7 +105,7 @@ namespace ams::ncm::fs {
bool has_root = false; bool has_root = false;
R_TRY(HasDirectory(&has_root, root_path)); R_TRY(HasDirectory(&has_root, root_path));
R_UNLESS(has_root, ncm::ResultContentStorageBaseNotFound()); R_UNLESS(has_root, ncm::ResultContentStorageBaseNotFound());
path::GetContentRootPath(content_root, root_path); path::GetContentRootPath(content_root, root_path);
bool has_content_root = false; bool has_content_root = false;
R_TRY(HasDirectory(&has_content_root, content_root)); R_TRY(HasDirectory(&has_content_root, content_root));
@ -213,7 +213,7 @@ namespace ams::ncm::fs {
Result MountSystemSaveData(const char *mount_point, FsSaveDataSpaceId space_id, u64 save_id) { Result MountSystemSaveData(const char *mount_point, FsSaveDataSpaceId space_id, u64 save_id) {
R_UNLESS(mount_point, ams::fs::ResultNullptrArgument()); R_UNLESS(mount_point, ams::fs::ResultNullptrArgument());
FsSaveDataAttribute save = { FsSaveDataAttribute save = {
.system_save_data_id = save_id, .system_save_data_id = save_id,
.save_data_type = FsSaveDataType_System, .save_data_type = FsSaveDataType_System,
@ -247,7 +247,7 @@ namespace ams::ncm::fs {
case FsContentStorageId_System: case FsContentStorageId_System:
g_mount_content_storage[mount_point] = SystemContentMountName; g_mount_content_storage[mount_point] = SystemContentMountName;
break; break;
case FsContentStorageId_User: case FsContentStorageId_User:
g_mount_content_storage[mount_point] = UserContentMountName; g_mount_content_storage[mount_point] = UserContentMountName;
break; break;
@ -264,7 +264,7 @@ namespace ams::ncm::fs {
Result MountGameCardPartition(const char *mount_point, const FsGameCardHandle handle, FsGameCardPartition partition) { Result MountGameCardPartition(const char *mount_point, const FsGameCardHandle handle, FsGameCardPartition partition) {
AMS_ABORT_UNLESS(partition <= 2); AMS_ABORT_UNLESS(partition <= 2);
FsFileSystem fs; FsFileSystem fs;
R_TRY(fsOpenGameCardFileSystem(&fs, &handle, partition)); R_TRY(fsOpenGameCardFileSystem(&fs, &handle, partition));
AMS_ABORT_UNLESS(fsdevMountDevice(mount_point, fs) != -1); AMS_ABORT_UNLESS(fsdevMountDevice(mount_point, fs) != -1);
@ -302,7 +302,7 @@ namespace ams::ncm::fs {
Result GetSaveDataFlags(u32 *out_flags, u64 save_id) { Result GetSaveDataFlags(u32 *out_flags, u64 save_id) {
FsSaveDataExtraData extra_data; FsSaveDataExtraData extra_data;
R_TRY(fsReadSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), save_id)); R_TRY(fsReadSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), save_id));
*out_flags = extra_data.flags; *out_flags = extra_data.flags;
return ResultSuccess(); return ResultSuccess();
@ -310,7 +310,7 @@ namespace ams::ncm::fs {
Result SetSaveDataFlags(u64 save_id, FsSaveDataSpaceId space_id, u32 flags) { Result SetSaveDataFlags(u64 save_id, FsSaveDataSpaceId space_id, u32 flags) {
FsSaveDataExtraData extra_data; FsSaveDataExtraData extra_data;
R_TRY(fsReadSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), save_id)); R_TRY(fsReadSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), save_id));
extra_data.flags = flags; extra_data.flags = flags;
R_TRY(fsWriteSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), space_id, save_id)); R_TRY(fsWriteSaveDataFileSystemExtraData(&extra_data, sizeof(FsSaveDataExtraData), space_id, save_id));

View File

@ -55,7 +55,7 @@ namespace ams::ncm::fs {
DIR *dir; DIR *dir;
struct dirent *dir_entry = nullptr; struct dirent *dir_entry = nullptr;
R_UNLESS(max_level >= 1, ResultSuccess()); R_UNLESS(max_level >= 1, ResultSuccess());
bool retry_dir_read = true; bool retry_dir_read = true;
while (retry_dir_read) { while (retry_dir_read) {
retry_dir_read = false; retry_dir_read = false;
@ -70,7 +70,7 @@ namespace ams::ncm::fs {
char current_path[FS_MAX_PATH]; char current_path[FS_MAX_PATH];
AMS_ABORT_UNLESS(snprintf(current_path, FS_MAX_PATH-1, "%s/%s", root_path, dir_entry->d_name) >= 0); AMS_ABORT_UNLESS(snprintf(current_path, FS_MAX_PATH-1, "%s/%s", root_path, dir_entry->d_name) >= 0);
bool should_continue = true; bool should_continue = true;
bool should_retry_dir_read = false; bool should_retry_dir_read = false;
R_TRY(f(&should_continue, &should_retry_dir_read, current_path, dir_entry)); R_TRY(f(&should_continue, &should_retry_dir_read, current_path, dir_entry));

View File

@ -37,7 +37,7 @@ namespace ams::ncm::path {
class PathView { class PathView {
private: private:
std::string_view path; /* Nintendo uses nn::util::string_view here. */ std::string_view path; /* Nintendo uses nn::util::string_view here. */
public: public:
PathView(std::string_view p) : path(p) { /* ...*/ } PathView(std::string_view p) : path(p) { /* ...*/ }
bool HasPrefix(std::string_view prefix) const; bool HasPrefix(std::string_view prefix) const;

View File

@ -40,8 +40,8 @@ namespace ams::ncm {
u64 converted_val; u64 converted_val;
for (size_t i = 0; i < sizeof(PlaceHolderId); i++) { for (size_t i = 0; i < sizeof(PlaceHolderId); i++) {
char *name_char_pair = dir_entry->d_name + i * 2; char *name_char_pair = dir_entry->d_name + i * 2;
byte_string[0] = name_char_pair[0]; byte_string[0] = name_char_pair[0];
byte_string[1] = name_char_pair[1]; byte_string[1] = name_char_pair[1];
@ -66,8 +66,8 @@ namespace ams::ncm {
u64 converted_val; u64 converted_val;
for (size_t i = 0; i < sizeof(ContentId); i++) { for (size_t i = 0; i < sizeof(ContentId); i++) {
const char *char_par = str + i * 2; const char *char_par = str + i * 2;
byte_string[0] = char_par[0]; byte_string[0] = char_par[0];
byte_string[1] = char_par[1]; byte_string[1] = char_par[1];

View File

@ -26,5 +26,5 @@ namespace ams::ncm {
Result GetPlaceHolderIdFromDirEntry(PlaceHolderId *out, struct dirent *dir_entry); Result GetPlaceHolderIdFromDirEntry(PlaceHolderId *out, struct dirent *dir_entry);
std::optional<ContentId> GetContentIdFromString(const char *str, size_t len); std::optional<ContentId> GetContentIdFromString(const char *str, size_t len);
}; };