[Static Analysis] Resolved some issues mentioned in Alexandr-u report
This commit is contained in:
parent
b471423c1a
commit
3ac98ebfba
|
@ -31,13 +31,13 @@ X_STATUS SDLAudioSystem::CreateDriver(size_t index,
|
|||
xe::threading::Semaphore* semaphore,
|
||||
AudioDriver** out_driver) {
|
||||
assert_not_null(out_driver);
|
||||
auto driver = new SDLAudioDriver(semaphore);
|
||||
auto driver = std::make_unique<SDLAudioDriver>(semaphore);
|
||||
if (!driver->Initialize()) {
|
||||
driver->Shutdown();
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
*out_driver = driver;
|
||||
*out_driver = driver.release();
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ X_STATUS XAudio2AudioSystem::CreateDriver(size_t index,
|
|||
xe::threading::Semaphore* semaphore,
|
||||
AudioDriver** out_driver) {
|
||||
assert_not_null(out_driver);
|
||||
auto driver = new XAudio2AudioDriver(semaphore);
|
||||
auto driver = std::make_unique<XAudio2AudioDriver>(semaphore);
|
||||
if (!driver->Initialize()) {
|
||||
driver->Shutdown();
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
*out_driver = driver;
|
||||
*out_driver = driver.release();
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <filesystem>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
@ -122,7 +123,8 @@ struct FileInfo {
|
|||
uint64_t access_timestamp;
|
||||
uint64_t write_timestamp;
|
||||
};
|
||||
bool GetInfo(const std::filesystem::path& path, FileInfo* out_info);
|
||||
|
||||
std::optional<FileInfo> GetInfo(const std::filesystem::path& path);
|
||||
std::vector<FileInfo> ListFiles(const std::filesystem::path& path);
|
||||
std::vector<FileInfo> ListDirectories(const std::filesystem::path& path);
|
||||
std::vector<FileInfo> FilterByName(const std::vector<FileInfo>& files,
|
||||
|
|
|
@ -205,26 +205,28 @@ std::unique_ptr<FileHandle> FileHandle::OpenExisting(
|
|||
|
||||
#define COMBINE_TIME(t) (((uint64_t)t.dwHighDateTime << 32) | t.dwLowDateTime)
|
||||
|
||||
bool GetInfo(const std::filesystem::path& path, FileInfo* out_info) {
|
||||
std::memset(out_info, 0, sizeof(FileInfo));
|
||||
std::optional<FileInfo> GetInfo(const std::filesystem::path& path) {
|
||||
WIN32_FILE_ATTRIBUTE_DATA data = {0};
|
||||
if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &data)) {
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
FileInfo out_info{};
|
||||
|
||||
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
out_info->type = FileInfo::Type::kDirectory;
|
||||
out_info->total_size = 0;
|
||||
out_info.type = FileInfo::Type::kDirectory;
|
||||
out_info.total_size = 0;
|
||||
} else {
|
||||
out_info->type = FileInfo::Type::kFile;
|
||||
out_info->total_size =
|
||||
out_info.type = FileInfo::Type::kFile;
|
||||
out_info.total_size =
|
||||
(data.nFileSizeHigh * (size_t(MAXDWORD) + 1)) + data.nFileSizeLow;
|
||||
}
|
||||
out_info->path = path.parent_path();
|
||||
out_info->name = path.filename();
|
||||
out_info->create_timestamp = COMBINE_TIME(data.ftCreationTime);
|
||||
out_info->access_timestamp = COMBINE_TIME(data.ftLastAccessTime);
|
||||
out_info->write_timestamp = COMBINE_TIME(data.ftLastWriteTime);
|
||||
return true;
|
||||
out_info.path = path.parent_path();
|
||||
out_info.name = path.filename();
|
||||
out_info.create_timestamp = COMBINE_TIME(data.ftCreationTime);
|
||||
out_info.access_timestamp = COMBINE_TIME(data.ftLastAccessTime);
|
||||
out_info.write_timestamp = COMBINE_TIME(data.ftLastWriteTime);
|
||||
return std::move(out_info);
|
||||
}
|
||||
|
||||
std::vector<FileInfo> ListFiles(const std::filesystem::path& path) {
|
||||
|
|
|
@ -306,7 +306,7 @@ void Win32X64CodeCache::InitializeUnwindEntry(
|
|||
unwind_code->FrameOffset = (USHORT)(func_info.stack_size) / 8;
|
||||
}
|
||||
|
||||
if (unwind_info->CountOfCodes % 1) {
|
||||
if (unwind_info->CountOfCodes % 2) {
|
||||
// Count of unwind codes must always be even.
|
||||
std::memset(&unwind_info->UnwindCode[unwind_info->CountOfCodes + 1], 0,
|
||||
sizeof(UNWIND_CODE));
|
||||
|
|
|
@ -3151,11 +3151,11 @@ void D3D12CommandProcessor::CheckSubmissionFence(uint64_t await_submission) {
|
|||
if (queue_operations_done_since_submission_signal_) {
|
||||
UINT64 fence_value = ++queue_operations_since_submission_fence_last_;
|
||||
ID3D12CommandQueue* direct_queue = GetD3D12Provider().GetDirectQueue();
|
||||
if (SUCCEEDED(
|
||||
direct_queue->Signal(queue_operations_since_submission_fence_,
|
||||
fence_value) &&
|
||||
SUCCEEDED(queue_operations_since_submission_fence_
|
||||
->SetEventOnCompletion(fence_value, nullptr)))) {
|
||||
if (SUCCEEDED(direct_queue->Signal(
|
||||
queue_operations_since_submission_fence_, fence_value)) &&
|
||||
SUCCEEDED(
|
||||
queue_operations_since_submission_fence_->SetEventOnCompletion(
|
||||
fence_value, nullptr))) {
|
||||
queue_operations_done_since_submission_signal_ = false;
|
||||
} else {
|
||||
XELOGE(
|
||||
|
|
|
@ -53,9 +53,6 @@ static TextureExtent CalculateExtent(const FormatInfo* format_info,
|
|||
extent.block_pitch_h = byte_pitch / bytes_per_block;
|
||||
extent.pitch = extent.block_pitch_h * format_info->block_width;
|
||||
}
|
||||
|
||||
// Is depth special?
|
||||
extent.depth = extent.depth;
|
||||
} else {
|
||||
extent.pitch = extent.block_pitch_h * format_info->block_width;
|
||||
extent.height = extent.block_pitch_v * format_info->block_height;
|
||||
|
|
|
@ -775,7 +775,7 @@ bool VulkanRenderTargetCache::Initialize(uint32_t shared_memory_binding_count) {
|
|||
: shaders::resolve_clear_64bpp_cs,
|
||||
draw_resolution_scaled ? sizeof(shaders::resolve_clear_64bpp_scaled_cs)
|
||||
: sizeof(shaders::resolve_clear_64bpp_cs));
|
||||
if (resolve_fsi_clear_32bpp_pipeline_ == VK_NULL_HANDLE) {
|
||||
if (resolve_fsi_clear_64bpp_pipeline_ == VK_NULL_HANDLE) {
|
||||
XELOGE(
|
||||
"VulkanRenderTargetCache: Failed to create the 64bpp resolve EDRAM "
|
||||
"buffer clear pipeline");
|
||||
|
|
|
@ -44,12 +44,16 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
|||
(uint32_t)data->extra_ptr, (uint32_t)data->buffer_ptr,
|
||||
(uint32_t)data->buffer_size, (uint32_t)data->unk_14,
|
||||
(uint32_t)data->length_ptr, (uint32_t)data->unk_1C);
|
||||
if (!data->buffer_ptr || !data->extra_ptr) {
|
||||
return X_E_INVALIDARG;
|
||||
}
|
||||
|
||||
auto extra = memory_->TranslateVirtual<X_KENUMERATOR_CONTENT_AGGREGATE*>(
|
||||
data->extra_ptr);
|
||||
auto buffer = memory_->TranslateVirtual(data->buffer_ptr);
|
||||
auto e = kernel_state_->object_table()->LookupObject<XEnumerator>(
|
||||
extra->handle);
|
||||
if (!e || !buffer || !extra) {
|
||||
if (!e) {
|
||||
return X_E_INVALIDARG;
|
||||
}
|
||||
assert_true(extra->magic == kXObjSignature);
|
||||
|
|
|
@ -90,12 +90,12 @@ std::unique_ptr<Entry> HostPathEntry::CreateEntryInternal(
|
|||
}
|
||||
fclose(file);
|
||||
}
|
||||
xe::filesystem::FileInfo file_info;
|
||||
if (!xe::filesystem::GetInfo(full_path, &file_info)) {
|
||||
auto file_info = xe::filesystem::GetInfo(full_path);
|
||||
if (!file_info) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::unique_ptr<Entry>(
|
||||
HostPathEntry::Create(device_, this, full_path, file_info));
|
||||
HostPathEntry::Create(device_, this, full_path, file_info.value()));
|
||||
}
|
||||
|
||||
bool HostPathEntry::DeleteEntryInternal(Entry* entry) {
|
||||
|
@ -123,14 +123,14 @@ void HostPathEntry::RenameEntryInternal(const std::filesystem::path file_path) {
|
|||
}
|
||||
|
||||
void HostPathEntry::update() {
|
||||
xe::filesystem::FileInfo file_info;
|
||||
if (!xe::filesystem::GetInfo(host_path_, &file_info)) {
|
||||
auto file_info = xe::filesystem::GetInfo(host_path_);
|
||||
if (!file_info) {
|
||||
return;
|
||||
}
|
||||
if (file_info.type == xe::filesystem::FileInfo::Type::kFile) {
|
||||
size_ = file_info.total_size;
|
||||
if (file_info->type == xe::filesystem::FileInfo::Type::kFile) {
|
||||
size_ = file_info->total_size;
|
||||
allocation_size_ =
|
||||
xe::round_up(file_info.total_size, device()->bytes_per_sector());
|
||||
xe::round_up(file_info->total_size, device()->bytes_per_sector());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue