From 1788ee158913dc7364ce7b2e84dcdc7b22be68e9 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 3 Jul 2015 19:57:18 -0500 Subject: [PATCH] Linting. --- src/xenia/cpu/xex_module.cc | 2 +- src/xenia/kernel/kernel_state.cc | 3 +-- src/xenia/kernel/objects/xthread.cc | 7 ++----- src/xenia/kernel/objects/xuser_module.cc | 15 +++++++-------- src/xenia/kernel/util/xex2.cc | 17 ++++++++--------- src/xenia/kernel/util/xex2.h | 3 +-- 6 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/xenia/cpu/xex_module.cc b/src/xenia/cpu/xex_module.cc index 3c658cd87..af6f6e588 100644 --- a/src/xenia/cpu/xex_module.cc +++ b/src/xenia/cpu/xex_module.cc @@ -114,7 +114,7 @@ uint32_t XexModule::GetProcAddress(uint16_t ordinal) const { xex2_opt_data_directory* pe_export_directory = 0; if (GetOptHeader(XEX_HEADER_EXPORTS_BY_NAME, &pe_export_directory)) { auto e = memory()->TranslateVirtual( - *exe_address + pe_export_directory->offset); + *exe_address + pe_export_directory->offset); assert_not_null(e); uint32_t* function_table = (uint32_t*)((uint8_t*)e + e->AddressOfFunctions); diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 5435e45c0..5c1f32ea8 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -122,8 +122,7 @@ uint32_t KernelState::title_id() const { assert_not_null(executable_module_); xex2_opt_execution_info* exec_info = 0; - executable_module_->GetOptHeader(XEX_HEADER_EXECUTION_INFO, - &exec_info); + executable_module_->GetOptHeader(XEX_HEADER_EXECUTION_INFO, &exec_info); if (exec_info) { return exec_info->title_id; diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 8330a4244..494086b85 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -586,11 +586,8 @@ void XThread::DeliverAPCs(void* data) { // kernel_routine(apc_address, &normal_routine, &normal_context, // &system_arg1, &system_arg2) uint64_t kernel_args[] = { - apc_ptr, - thread->scratch_address_ + 0, - thread->scratch_address_ + 4, - thread->scratch_address_ + 8, - thread->scratch_address_ + 12, + apc_ptr, thread->scratch_address_ + 0, thread->scratch_address_ + 4, + thread->scratch_address_ + 8, thread->scratch_address_ + 12, }; processor->Execute(thread->thread_state(), apc->kernel_routine, kernel_args, xe::countof(kernel_args)); diff --git a/src/xenia/kernel/objects/xuser_module.cc b/src/xenia/kernel/objects/xuser_module.cc index f1c470c2e..df8b6e3f7 100644 --- a/src/xenia/kernel/objects/xuser_module.cc +++ b/src/xenia/kernel/objects/xuser_module.cc @@ -380,12 +380,9 @@ void XUserModule::Dump() { auto opt_exec_info = reinterpret_cast(opt_header_ptr); - printf(" Media ID: %.8X\n", - (uint32_t)opt_exec_info->media_id); - printf(" Title ID: %.8X\n", - (uint32_t)opt_exec_info->title_id); - printf(" Savegame ID: %.8X\n", - (uint32_t)opt_exec_info->title_id); + printf(" Media ID: %.8X\n", (uint32_t)opt_exec_info->media_id); + printf(" Title ID: %.8X\n", (uint32_t)opt_exec_info->title_id); + printf(" Savegame ID: %.8X\n", (uint32_t)opt_exec_info->title_id); printf(" Disc Number / Total: %d / %d\n", (uint8_t)opt_exec_info->disc_number, (uint8_t)opt_exec_info->disc_count); @@ -422,13 +419,15 @@ void XUserModule::Dump() { exe_address + dir->offset); // e->AddressOfX RVAs are relative to the IMAGE_EXPORT_DIRECTORY! - uint32_t* function_table = (uint32_t*)((uint64_t)e + e->AddressOfFunctions); + uint32_t* function_table = + (uint32_t*)((uint64_t)e + e->AddressOfFunctions); // Names relative to directory uint32_t* name_table = (uint32_t*)((uint64_t)e + e->AddressOfNames); // Table of ordinals (by name) - uint16_t* ordinal_table = (uint16_t*)((uint64_t)e + e->AddressOfNameOrdinals); + uint16_t* ordinal_table = + (uint16_t*)((uint64_t)e + e->AddressOfNameOrdinals); for (uint32_t i = 0; i < e->NumberOfNames; i++) { const char* name = (const char*)((uint8_t*)e + name_table[i]); diff --git a/src/xenia/kernel/util/xex2.cc b/src/xenia/kernel/util/xex2.cc index 94f2a387b..f44945ed9 100644 --- a/src/xenia/kernel/util/xex2.cc +++ b/src/xenia/kernel/util/xex2.cc @@ -27,8 +27,7 @@ #include "xenia/base/memory.h" #include "xenia/base/platform.h" -namespace xe { -} // namespace xe +namespace xe {} // namespace xe // TODO(benvanik): remove. #define XEEXPECTZERO(expr) \ @@ -247,9 +246,10 @@ int xe_xex2_read_header(const uint8_t* addr, const size_t length, } break; case XEX_HEADER_IMPORT_LIBRARIES: { auto import_libraries = - reinterpret_cast(pp); + reinterpret_cast(pp); - const uint32_t max_count = (uint32_t)xe::countof(header->import_libraries); + const uint32_t max_count = + (uint32_t)xe::countof(header->import_libraries); uint32_t count = import_libraries->library_count; assert_true(count <= max_count); if (count > max_count) { @@ -260,7 +260,7 @@ int xe_xex2_read_header(const uint8_t* addr, const size_t length, header->import_library_count = count; uint32_t string_table_size = import_libraries->string_table_size; - const char *string_table[32]; // Pretend 32 is max_count + const char* string_table[32]; // Pretend 32 is max_count std::memset(string_table, 0, sizeof(string_table)); // Parse the string table @@ -279,15 +279,14 @@ int xe_xex2_read_header(const uint8_t* addr, const size_t length, pp += 12 + import_libraries->string_table_size; for (size_t m = 0; m < count; m++) { xe_xex2_import_library_t* library = &header->import_libraries[m]; - auto src_library = (xe::xex2_import_library *)pp; + auto src_library = (xe::xex2_import_library*)pp; memcpy(library->digest, pp + 0x04, 20); library->import_id = src_library->id; library->version.value = src_library->version.value; library->min_version.value = src_library->version_min.value; - std::strncpy(library->name, - string_table[src_library->name_index], + std::strncpy(library->name, string_table[src_library->name_index], xe::countof(library->name)); library->record_count = src_library->count; @@ -1056,7 +1055,7 @@ uint32_t xe_xex2_lookup_export(xe_xex2_ref xex, uint16_t ordinal) { // XEX-style export table. if (header->loader_info.export_table) { - auto export_table = reinterpret_cast( + auto export_table = reinterpret_cast( xex->memory->TranslateVirtual(header->loader_info.export_table)); uint32_t ordinal_count = export_table->count; uint32_t ordinal_base = export_table->base; diff --git a/src/xenia/kernel/util/xex2.h b/src/xenia/kernel/util/xex2.h index 77493087f..f4499ef11 100644 --- a/src/xenia/kernel/util/xex2.h +++ b/src/xenia/kernel/util/xex2.h @@ -13,8 +13,7 @@ #include "xenia/kernel/util/xex2_info.h" #include "xenia/memory.h" -namespace xe { -} // namespace xe +namespace xe {} // namespace xe typedef struct { int reserved; } xe_xex2_options_t;