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

View file

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

View file

@ -55,7 +55,7 @@ namespace ams::ncm::fs {
DIR *dir;
struct dirent *dir_entry = nullptr;
R_UNLESS(max_level >= 1, ResultSuccess());
bool retry_dir_read = true;
while (retry_dir_read) {
retry_dir_read = false;
@ -70,7 +70,7 @@ namespace ams::ncm::fs {
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);
bool should_continue = true;
bool should_retry_dir_read = false;
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 {
private:
std::string_view path; /* Nintendo uses nn::util::string_view here. */
std::string_view path; /* Nintendo uses nn::util::string_view here. */
public:
PathView(std::string_view p) : path(p) { /* ...*/ }
bool HasPrefix(std::string_view prefix) const;

View file

@ -40,8 +40,8 @@ namespace ams::ncm {
u64 converted_val;
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[1] = name_char_pair[1];
@ -66,8 +66,8 @@ namespace ams::ncm {
u64 converted_val;
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[1] = char_par[1];

View file

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