mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-13 20:52:15 +02:00
ncm: minor fixes
This commit is contained in:
parent
7a4ecc67a1
commit
f93a1a987c
@ -153,7 +153,7 @@ namespace ams::ncm::impl {
|
|||||||
R_TRY(ConvertNotFoundResult(this->Open(&f, placeholder_id)));
|
R_TRY(ConvertNotFoundResult(this->Open(&f, placeholder_id)));
|
||||||
ON_SCOPE_EXIT { this->StoreToCache(f, placeholder_id); };
|
ON_SCOPE_EXIT { this->StoreToCache(f, placeholder_id); };
|
||||||
|
|
||||||
R_TRY(fs::WriteFile(f, offset, buffer, size, !this->delay_flush));
|
R_TRY(fs::WriteFile(f, offset, buffer, size, this->delay_flush ? ams::fs::WriteOption::Flush : ams::fs::WriteOption::None));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,22 +167,20 @@ namespace ams::ncm::impl {
|
|||||||
|
|
||||||
Result PlaceHolderAccessor::GetSize(bool *found_in_cache, size_t *out_size, PlaceHolderId placeholder_id) {
|
Result PlaceHolderAccessor::GetSize(bool *found_in_cache, size_t *out_size, PlaceHolderId placeholder_id) {
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
|
||||||
|
*found_in_cache = false;
|
||||||
|
|
||||||
/* 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 (placeholder_id == InvalidPlaceHolderId) {
|
/* If the placeholder id is invalid, return success early. */
|
||||||
*found_in_cache = false;
|
R_UNLESS(placeholder_id != InvalidPlaceHolderId, ResultSuccess());
|
||||||
return ResultSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
CacheEntry *cache_entry = this->FindInCache(placeholder_id);
|
CacheEntry *cache_entry = this->FindInCache(placeholder_id);
|
||||||
|
|
||||||
if (cache_entry == nullptr) {
|
/* If there is no entry in the cache, return success early. */
|
||||||
*found_in_cache = false;
|
R_UNLESS(cache_entry != nullptr, ResultSuccess());
|
||||||
return ResultSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
cache_entry->id = InvalidPlaceHolderId;
|
cache_entry->id = InvalidPlaceHolderId;
|
||||||
f = cache_entry->handle;
|
f = cache_entry->handle;
|
||||||
|
@ -467,7 +467,7 @@ namespace ams::ncm {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
};
|
};
|
||||||
|
|
||||||
R_TRY(fs::WriteFile(f, offset, data.GetPointer(), data.GetSize(), FsWriteOption_Flush));
|
R_TRY(fs::WriteFile(f, offset, data.GetPointer(), data.GetSize(), ams::fs::WriteOption::Flush));
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user