From e6461f326c7c59ce2e47305a47c7e1f77397f746 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 5 Aug 2015 22:06:20 -0700 Subject: [PATCH] Some xb style cleanup. --- src/xenia/base/arena.cc | 6 +++--- src/xenia/base/arena.h | 10 +++++----- src/xenia/base/byte_order.h | 4 ---- src/xenia/base/clock.cc | 8 ++++---- src/xenia/base/clock.h | 2 +- src/xenia/base/filesystem.cc | 14 +++++++------- src/xenia/base/filesystem.h | 4 ++-- src/xenia/base/filesystem_win.cc | 6 +++--- src/xenia/base/logging.cc | 1 + src/xenia/base/logging.h | 6 +++--- src/xenia/base/memory.cc | 16 ++++++++-------- src/xenia/base/memory_test.cc | 3 --- src/xenia/base/platform.h | 16 ++++++++++------ src/xenia/base/reset_scope.h | 2 +- src/xenia/base/ring_buffer.h | 2 +- src/xenia/base/socket.h | 5 ++++- src/xenia/base/socket_win.cc | 14 +++++++------- src/xenia/base/string.cc | 4 ++-- src/xenia/base/string.h | 8 ++++---- src/xenia/base/string_buffer.h | 2 +- src/xenia/base/threading.h | 1 + src/xenia/base/threading_win.cc | 14 +++++++------- src/xenia/cpu/backend/x64/x64_emitter.cc | 2 +- .../cpu/frontend/testing/ppc_testing_main.cc | 2 +- src/xenia/cpu/raw_module.cc | 2 +- src/xenia/emulator.cc | 2 +- src/xenia/gpu/gl4/gl4_shader.cc | 2 +- src/xenia/kernel/content_manager.cc | 4 ++-- src/xenia/kernel/xam_net.cc | 8 +++++--- 29 files changed, 87 insertions(+), 83 deletions(-) diff --git a/src/xenia/base/arena.cc b/src/xenia/base/arena.cc index ef5e65a85..ec3a44606 100644 --- a/src/xenia/base/arena.cc +++ b/src/xenia/base/arena.cc @@ -83,8 +83,8 @@ size_t Arena::CalculateSize() { void* Arena::CloneContents() { size_t total_length = CalculateSize(); - void* result = malloc(total_length); - uint8_t* p = (uint8_t*)result; + auto result = reinterpret_cast(malloc(total_length)); + auto p = result; Chunk* chunk = head_chunk_; while (chunk) { std::memcpy(p, chunk->buffer, chunk->offset); @@ -98,7 +98,7 @@ void* Arena::CloneContents() { } void Arena::CloneContents(void* buffer, size_t buffer_length) { - uint8_t* p = (uint8_t*)buffer; + uint8_t* p = reinterpret_cast(buffer); Chunk* chunk = head_chunk_; while (chunk) { std::memcpy(p, chunk->buffer, chunk->offset); diff --git a/src/xenia/base/arena.h b/src/xenia/base/arena.h index 706db4550..8b6a90707 100644 --- a/src/xenia/base/arena.h +++ b/src/xenia/base/arena.h @@ -18,7 +18,7 @@ namespace xe { class Arena { public: - Arena(size_t chunk_size = 4 * 1024 * 1024); + explicit Arena(size_t chunk_size = 4 * 1024 * 1024); ~Arena(); void Reset(); @@ -33,15 +33,15 @@ class Arena { void* CloneContents(); template - void CloneContents(std::vector& buffer) { - buffer.resize(CalculateSize() / sizeof(T)); - CloneContents(buffer.data(), buffer.size() * sizeof(T)); + void CloneContents(std::vector* buffer) { + buffer->resize(CalculateSize() / sizeof(T)); + CloneContents(buffer->data(), buffer->size() * sizeof(T)); } private: class Chunk { public: - Chunk(size_t chunk_size); + explicit Chunk(size_t chunk_size); ~Chunk(); Chunk* next; diff --git a/src/xenia/base/byte_order.h b/src/xenia/base/byte_order.h index 7cd842c38..13687b06e 100644 --- a/src/xenia/base/byte_order.h +++ b/src/xenia/base/byte_order.h @@ -15,10 +15,6 @@ #include "xenia/base/assert.h" #include "xenia/base/platform.h" -#if XE_PLATFORM_MAC -#include -#endif // XE_PLATFORM_MAC - namespace xe { #if XE_PLATFORM_WIN32 diff --git a/src/xenia/base/clock.cc b/src/xenia/base/clock.cc index cf60aa9ea..0526c9d1c 100644 --- a/src/xenia/base/clock.cc +++ b/src/xenia/base/clock.cc @@ -33,7 +33,7 @@ thread_local uint64_t last_host_tick_count_ = Clock::QueryHostTickCount(); void RecomputeGuestTickScalar() { guest_tick_scalar_ = (guest_tick_frequency_ * guest_time_scalar_) / - double(Clock::host_tick_frequency()); + static_cast(Clock::host_tick_frequency()); } void UpdateGuestClock() { @@ -108,7 +108,7 @@ int64_t Clock::ScaleGuestDurationFileTime(int64_t guest_file_time) { return scaled_file_time; } -void Clock::ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec) { +void Clock::ScaleGuestDurationTimeval(int32_t* tv_sec, int32_t* tv_usec) { uint64_t scaled_sec = uint64_t(uint64_t(*tv_sec) * guest_tick_scalar_); uint64_t scaled_usec = uint64_t(uint64_t(*tv_usec) * guest_time_scalar_); if (scaled_usec > UINT_MAX) { @@ -116,8 +116,8 @@ void Clock::ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec) { scaled_usec -= overflow_sec * 1000000; scaled_sec += overflow_sec; } - *tv_sec = long(scaled_sec); - *tv_usec = long(scaled_usec); + *tv_sec = int32_t(scaled_sec); + *tv_usec = int32_t(scaled_usec); } } // namespace xe diff --git a/src/xenia/base/clock.h b/src/xenia/base/clock.h index 31ae5a288..03113191f 100644 --- a/src/xenia/base/clock.h +++ b/src/xenia/base/clock.h @@ -52,7 +52,7 @@ class Clock { // Scales a time duration in 100ns ticks like FILETIME, from guest time. static int64_t ScaleGuestDurationFileTime(int64_t guest_file_time); // Scales a time duration represented as a timeval, from guest time. - static void ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec); + static void ScaleGuestDurationTimeval(int32_t* tv_sec, int32_t* tv_usec); }; } // namespace xe diff --git a/src/xenia/base/filesystem.cc b/src/xenia/base/filesystem.cc index 0362a6f15..1cb20a229 100644 --- a/src/xenia/base/filesystem.cc +++ b/src/xenia/base/filesystem.cc @@ -15,7 +15,7 @@ namespace xe { namespace filesystem { std::string CanonicalizePath(const std::string& original_path) { - char path_sep(xe::path_separator); + char path_sep(xe::kPathSeparator); std::string path(xe::fix_path_separators(original_path, path_sep)); std::vector path_breaks; @@ -111,19 +111,19 @@ WildcardRule::WildcardRule(const std::string& str_match, } bool WildcardRule::Check(const std::string& str_lower, - std::string::size_type& offset) const { + std::string::size_type* offset) const { if (match.empty()) { return true; } - if ((str_lower.size() - offset) < match.size()) { + if ((str_lower.size() - *offset) < match.size()) { return false; } - std::string::size_type result(str_lower.find(match, offset)); + std::string::size_type result(str_lower.find(match, *offset)); if (result != std::string::npos) { - if (rules.FromStart && result != offset) { + if (rules.FromStart && result != *offset) { return false; } @@ -131,7 +131,7 @@ bool WildcardRule::Check(const std::string& str_lower, return false; } - offset = (result + match.size()); + *offset = (result + match.size()); return true; } @@ -168,7 +168,7 @@ bool WildcardEngine::Match(const std::string& str) const { std::string::size_type offset(0); for (const auto& rule : rules) { - if (!(rule.Check(str_lc, offset))) { + if (!(rule.Check(str_lc, &offset))) { return false; } } diff --git a/src/xenia/base/filesystem.h b/src/xenia/base/filesystem.h index ff9403a9c..5dcdf348a 100644 --- a/src/xenia/base/filesystem.h +++ b/src/xenia/base/filesystem.h @@ -70,7 +70,7 @@ class FileHandle { virtual void Flush() = 0; protected: - FileHandle(std::wstring path) : path_(std::move(path)) {} + explicit FileHandle(std::wstring path) : path_(std::move(path)) {} std::wstring path_; }; @@ -105,7 +105,7 @@ class WildcardRule { public: WildcardRule(const std::string& str_match, const WildcardFlags& flags); bool Check(const std::string& str_lower, - std::string::size_type& offset) const; + std::string::size_type* offset) const; private: std::string match; diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc index 02b5c3e64..29c2076c7 100644 --- a/src/xenia/base/filesystem_win.cc +++ b/src/xenia/base/filesystem_win.cc @@ -22,12 +22,12 @@ bool PathExists(const std::wstring& path) { } bool CreateFolder(const std::wstring& path) { - wchar_t folder[MAX_PATH] = {0}; - auto end = std::wcschr(path.c_str(), xe::wpath_separator); + wchar_t folder[kMaxPath] = {0}; + auto end = std::wcschr(path.c_str(), xe::kWPathSeparator); while (end) { wcsncpy(folder, path.c_str(), end - path.c_str() + 1); CreateDirectory(folder, NULL); - end = wcschr(++end, xe::wpath_separator); + end = wcschr(++end, xe::kWPathSeparator); } return PathExists(path); } diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index f3630be38..977910250 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -13,6 +13,7 @@ #include #include +#include #include "xenia/base/main.h" #include "xenia/base/math.h" diff --git a/src/xenia/base/logging.h b/src/xenia/base/logging.h index e1a44d7bf..150655760 100644 --- a/src/xenia/base/logging.h +++ b/src/xenia/base/logging.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_LOGGING_H_ -#define XENIA_LOGGING_H_ +#ifndef XENIA_BASE_LOGGING_H_ +#define XENIA_BASE_LOGGING_H_ #include @@ -102,4 +102,4 @@ void handle_fatal(const char* fmt, ...); } // namespace xe -#endif // XENIA_LOGGING_H_ +#endif // XENIA_BASE_LOGGING_H_ diff --git a/src/xenia/base/memory.cc b/src/xenia/base/memory.cc index 4be51adb0..5656b9798 100644 --- a/src/xenia/base/memory.cc +++ b/src/xenia/base/memory.cc @@ -29,9 +29,9 @@ void copy_and_swap_16_unaligned(uint16_t* dest, const uint16_t* src, __m128i input, output; for (i = 0; i + 8 <= count; i += 8) { - input = _mm_loadu_si128((__m128i*)&src[i]); + input = _mm_loadu_si128(reinterpret_cast(&src[i])); output = _mm_or_si128(_mm_slli_epi16(input, 8), _mm_srli_epi16(input, 8)); - _mm_storeu_si128((__m128i*)&dest[i], output); + _mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output); } for (; i < count; ++i) { // handle residual elements @@ -52,7 +52,7 @@ void copy_and_swap_32_unaligned(uint32_t* dest, const uint32_t* src, __m128i byte3mask = _mm_set1_epi32(0x0000FF00); for (i = 0; i + 4 <= count; i += 4) { - input = _mm_loadu_si128((__m128i*)&src[i]); + input = _mm_loadu_si128(reinterpret_cast(&src[i])); // Do the four shifts byte1 = _mm_slli_epi32(input, 24); @@ -67,7 +67,7 @@ void copy_and_swap_32_unaligned(uint32_t* dest, const uint32_t* src, byte3 = _mm_and_si128(byte3, byte3mask); output = _mm_or_si128(output, byte3); - _mm_storeu_si128((__m128i*)&dest[i], output); + _mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output); } for (; i < count; ++i) { // handle residual elements @@ -88,7 +88,7 @@ void copy_and_swap_64_unaligned(uint64_t* dest, const uint64_t* src, __m128i byte3mask = _mm_set1_epi32(0x0000FF00); for (i = 0; i + 2 <= count; i += 2) { - input = _mm_loadu_si128((__m128i*)&src[i]); + input = _mm_loadu_si128(reinterpret_cast(&src[i])); // Do the four shifts byte1 = _mm_slli_epi32(input, 24); @@ -106,7 +106,7 @@ void copy_and_swap_64_unaligned(uint64_t* dest, const uint64_t* src, // Reorder the two words output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1)); - _mm_storeu_si128((__m128i*)&dest[i], output); + _mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output); } for (; i < count; ++i) { // handle residual elements @@ -119,9 +119,9 @@ void copy_and_swap_16_in_32_aligned(uint32_t* dest, const uint32_t* src, size_t i; __m128i input, output; for (i = 0; i + 4 <= count; i += 4) { - input = _mm_loadu_si128((__m128i*)&src[i]); + input = _mm_loadu_si128(reinterpret_cast(&src[i])); output = _mm_or_si128(_mm_slli_epi32(input, 16), _mm_srli_epi32(input, 16)); - _mm_storeu_si128((__m128i*)&dest[i], output); + _mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output); } for (; i < count; ++i) { // handle residual elements dest[i] = (src[i] >> 16) | (src[i] << 16); diff --git a/src/xenia/base/memory_test.cc b/src/xenia/base/memory_test.cc index e0d936c9c..ca35ea2b3 100644 --- a/src/xenia/base/memory_test.cc +++ b/src/xenia/base/memory_test.cc @@ -10,9 +10,6 @@ #include "third_party/catch/include/catch.hpp" #include "xenia/base/memory.h" -using namespace xe; -using namespace xe::memory; - TEST_CASE("copy_and_swap_16_aligned", "Copy and Swap") { // TODO(benvanik): tests. REQUIRE(true == true); diff --git a/src/xenia/base/platform.h b/src/xenia/base/platform.h index ea62a3609..d8e060a00 100644 --- a/src/xenia/base/platform.h +++ b/src/xenia/base/platform.h @@ -61,16 +61,20 @@ #include #endif // XE_PLATFORM_WIN32 +#if XE_PLATFORM_MAC +#include +#endif // XE_PLATFORM_MAC + namespace xe { #if XE_PLATFORM_WIN32 -const char path_separator = '\\'; -const wchar_t wpath_separator = L'\\'; -const size_t max_path = 260; // _MAX_PATH +const char kPathSeparator = '\\'; +const wchar_t kWPathSeparator = L'\\'; +const size_t kMaxPath = 260; // _MAX_PATH #else -const char path_separator = '/'; -const wchar_t wpath_separator = L'/'; -const size_t max_path = 1024; // PATH_MAX +const char kPathSeparator = '/'; +const wchar_t kWPathSeparator = L'/'; +const size_t kMaxPath = 1024; // PATH_MAX #endif // XE_PLATFORM_WIN32 // Launches a web browser to the given URL. diff --git a/src/xenia/base/reset_scope.h b/src/xenia/base/reset_scope.h index ec0ad90c8..870057107 100644 --- a/src/xenia/base/reset_scope.h +++ b/src/xenia/base/reset_scope.h @@ -17,7 +17,7 @@ namespace xe { template class ResetScope { public: - ResetScope(T* value) : value_(value) {} + explicit ResetScope(T* value) : value_(value) {} ~ResetScope() { if (value_) { value_->Reset(); diff --git a/src/xenia/base/ring_buffer.h b/src/xenia/base/ring_buffer.h index 2c5f56f6a..300c4cdb1 100644 --- a/src/xenia/base/ring_buffer.h +++ b/src/xenia/base/ring_buffer.h @@ -61,4 +61,4 @@ class RingBuffer { } // namespace xe -#endif // XENIA_BASE_RING_BUFFER_H_ \ No newline at end of file +#endif // XENIA_BASE_RING_BUFFER_H_ diff --git a/src/xenia/base/socket.h b/src/xenia/base/socket.h index 449824bbf..24e9112d5 100644 --- a/src/xenia/base/socket.h +++ b/src/xenia/base/socket.h @@ -13,6 +13,9 @@ #include #include #include +#include +#include +#include #include "xenia/base/threading.h" @@ -112,4 +115,4 @@ class SocketServer { } // namespace xe -#endif // XENIA_BASE_SOCKET_H_ \ No newline at end of file +#endif // XENIA_BASE_SOCKET_H_ diff --git a/src/xenia/base/socket_win.cc b/src/xenia/base/socket_win.cc index a718ed652..403c82447 100644 --- a/src/xenia/base/socket_win.cc +++ b/src/xenia/base/socket_win.cc @@ -14,11 +14,10 @@ #include "xenia/base/logging.h" -// platform_win.h must come first to include Windows headers. #include "xenia/base/platform_win.h" -#include -#include -#include +#include // NOLINT(must follow platform_win.h) +#include // NOLINT(must follow platform_win.h) +#include // NOLINT(must follow platform_win.h) namespace xe { @@ -63,7 +62,8 @@ class Win32Socket : public Socket { return false; } // Connect to server. - ret = connect(try_socket, ptr->ai_addr, (int)ptr->ai_addrlen); + ret = + connect(try_socket, ptr->ai_addr, static_cast(ptr->ai_addrlen)); if (ret == SOCKET_ERROR) { closesocket(try_socket); try_socket = INVALID_SOCKET; @@ -133,8 +133,8 @@ class Win32Socket : public Socket { if (socket_ == INVALID_SOCKET) { return -1; } - int ret = - recv(socket_, reinterpret_cast(buffer), int(buffer_capacity), 0); + int ret = recv(socket_, reinterpret_cast(buffer), + static_cast(buffer_capacity), 0); if (ret == SOCKET_ERROR) { int e = WSAGetLastError(); if (e == WSAEWOULDBLOCK) { diff --git a/src/xenia/base/string.cc b/src/xenia/base/string.cc index 06357ff7f..2590b19ac 100644 --- a/src/xenia/base/string.cc +++ b/src/xenia/base/string.cc @@ -43,11 +43,11 @@ std::string::size_type find_first_of_case(const std::string& target, std::wstring to_absolute_path(const std::wstring& path) { #if XE_PLATFORM_WIN32 - wchar_t buffer[xe::max_path]; + wchar_t buffer[kMaxPath]; _wfullpath(buffer, path.c_str(), sizeof(buffer) / sizeof(wchar_t)); return buffer; #else - char buffer[xe::max_path]; + char buffer[kMaxPath]; realpath(xe::to_string(path).c_str(), buffer); return xe::to_wstring(buffer); #endif // XE_PLATFORM_WIN32 diff --git a/src/xenia/base/string.h b/src/xenia/base/string.h index 8fb9b4b84..4c560671d 100644 --- a/src/xenia/base/string.h +++ b/src/xenia/base/string.h @@ -33,16 +33,16 @@ std::vector split_path(const std::string& path); // Joins two path segments with the given separator. std::string join_paths(const std::string& left, const std::string& right, - char sep = xe::path_separator); + char sep = xe::kPathSeparator); std::wstring join_paths(const std::wstring& left, const std::wstring& right, - wchar_t sep = xe::path_separator); + wchar_t sep = xe::kPathSeparator); // Replaces all path separators with the given value and removes redundant // separators. std::wstring fix_path_separators(const std::wstring& source, - wchar_t new_sep = xe::path_separator); + wchar_t new_sep = xe::kPathSeparator); std::string fix_path_separators(const std::string& source, - char new_sep = xe::path_separator); + char new_sep = xe::kPathSeparator); // Find the top directory name or filename from a path. std::string find_name_from_path(const std::string& path); diff --git a/src/xenia/base/string_buffer.h b/src/xenia/base/string_buffer.h index 35b3d3ff8..457ce0756 100644 --- a/src/xenia/base/string_buffer.h +++ b/src/xenia/base/string_buffer.h @@ -17,7 +17,7 @@ namespace xe { class StringBuffer { public: - StringBuffer(size_t initial_capacity = 0); + explicit StringBuffer(size_t initial_capacity = 0); ~StringBuffer(); size_t length() const { return buffer_offset_; } diff --git a/src/xenia/base/threading.h b/src/xenia/base/threading.h index 0dbee5988..fdedec71e 100644 --- a/src/xenia/base/threading.h +++ b/src/xenia/base/threading.h @@ -19,6 +19,7 @@ #include #include #include +#include #include namespace xe { diff --git a/src/xenia/base/threading_win.cc b/src/xenia/base/threading_win.cc index 64da0111a..30ad0e4d3 100644 --- a/src/xenia/base/threading_win.cc +++ b/src/xenia/base/threading_win.cc @@ -61,7 +61,7 @@ void set_name(DWORD thread_id, const std::string& name) { __try { RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), reinterpret_cast(&info)); - } __except (EXCEPTION_EXECUTE_HANDLER) { + } __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT } } @@ -149,7 +149,7 @@ std::unique_ptr HighResolutionTimer::CreateRepeating( template class Win32Handle : public T { public: - Win32Handle(HANDLE handle) : handle_(handle) {} + explicit Win32Handle(HANDLE handle) : handle_(handle) {} ~Win32Handle() override { CloseHandle(handle_); handle_ = nullptr; @@ -236,7 +236,7 @@ std::pair WaitMultiple(WaitHandle* wait_handles[], class Win32Event : public Win32Handle { public: - Win32Event(HANDLE handle) : Win32Handle(handle) {} + explicit Win32Event(HANDLE handle) : Win32Handle(handle) {} ~Win32Event() override = default; void Set() override { SetEvent(handle_); } void Reset() override { ResetEvent(handle_); } @@ -255,7 +255,7 @@ std::unique_ptr Event::CreateAutoResetEvent(bool initial_state) { class Win32Semaphore : public Win32Handle { public: - Win32Semaphore(HANDLE handle) : Win32Handle(handle) {} + explicit Win32Semaphore(HANDLE handle) : Win32Handle(handle) {} ~Win32Semaphore() override = default; bool Release(int release_count, int* out_previous_count) override { return ReleaseSemaphore(handle_, release_count, @@ -273,7 +273,7 @@ std::unique_ptr Semaphore::Create(int initial_count, class Win32Mutant : public Win32Handle { public: - Win32Mutant(HANDLE handle) : Win32Handle(handle) {} + explicit Win32Mutant(HANDLE handle) : Win32Handle(handle) {} ~Win32Mutant() = default; bool Release() override { return ReleaseMutex(handle_) ? true : false; } }; @@ -285,7 +285,7 @@ std::unique_ptr Mutant::Create(bool initial_owner) { class Win32Timer : public Win32Handle { public: - Win32Timer(HANDLE handle) : Win32Handle(handle) {} + explicit Win32Timer(HANDLE handle) : Win32Handle(handle) {} ~Win32Timer() = default; bool SetOnce(std::chrono::nanoseconds due_time, std::function opt_callback) override { @@ -349,7 +349,7 @@ std::unique_ptr Timer::CreateSynchronizationTimer() { class Win32Thread : public Win32Handle { public: - Win32Thread(HANDLE handle) : Win32Handle(handle) {} + explicit Win32Thread(HANDLE handle) : Win32Handle(handle) {} ~Win32Thread() = default; void set_name(std::string name) override { diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index 204775221..391dc98e6 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -111,7 +111,7 @@ bool X64Emitter::Emit(GuestFunction* function, HIRBuilder* builder, out_code_address = Emplace(stack_size, function); // Stash source map. - source_map_arena_.CloneContents(out_source_map); + source_map_arena_.CloneContents(&out_source_map); return true; } diff --git a/src/xenia/cpu/frontend/testing/ppc_testing_main.cc b/src/xenia/cpu/frontend/testing/ppc_testing_main.cc index 0660c80e1..3dd08dde7 100644 --- a/src/xenia/cpu/frontend/testing/ppc_testing_main.cc +++ b/src/xenia/cpu/frontend/testing/ppc_testing_main.cc @@ -50,7 +50,7 @@ struct TestCase { class TestSuite { public: TestSuite(const std::wstring& src_file_path) : src_file_path(src_file_path) { - name = src_file_path.substr(src_file_path.find_last_of(xe::path_separator) + + name = src_file_path.substr(src_file_path.find_last_of(xe::kPathSeparator) + 1); name = ReplaceExtension(name, L""); map_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".map"; diff --git a/src/xenia/cpu/raw_module.cc b/src/xenia/cpu/raw_module.cc index 72b7d03a0..02fde0fb3 100644 --- a/src/xenia/cpu/raw_module.cc +++ b/src/xenia/cpu/raw_module.cc @@ -45,7 +45,7 @@ bool RawModule::LoadFile(uint32_t base_address, const std::wstring& path) { fclose(file); // Setup debug info. - auto last_slash = fixed_path.find_last_of(xe::path_separator); + auto last_slash = fixed_path.find_last_of(xe::kPathSeparator); if (last_slash != std::string::npos) { name_ = xe::to_string(fixed_path.substr(last_slash + 1)); } else { diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index bf02743b0..efc7a6ec0 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -186,7 +186,7 @@ X_STATUS Emulator::Setup(ui::Window* display_window) { X_STATUS Emulator::LaunchPath(std::wstring path) { // Launch based on file type. // This is a silly guess based on file extension. - auto last_slash = path.find_last_of(xe::path_separator); + auto last_slash = path.find_last_of(xe::kPathSeparator); auto last_dot = path.find_last_of('.'); if (last_dot < last_slash) { last_dot = std::wstring::npos; diff --git a/src/xenia/gpu/gl4/gl4_shader.cc b/src/xenia/gpu/gl4/gl4_shader.cc index 74e9b208a..8fd849680 100644 --- a/src/xenia/gpu/gl4/gl4_shader.cc +++ b/src/xenia/gpu/gl4/gl4_shader.cc @@ -331,7 +331,7 @@ bool GL4Shader::CompileProgram(std::string source) { // Save to disk, if we asked for it. auto base_path = FLAGS_dump_shaders.c_str(); - char file_name[xe::max_path]; + char file_name[kMaxPath]; snprintf(file_name, xe::countof(file_name), "%s/gl4_gen_%.16llX.%s", base_path, data_hash_, shader_type_ == ShaderType::kVertex ? "vert" : "frag"); diff --git a/src/xenia/kernel/content_manager.cc b/src/xenia/kernel/content_manager.cc index 08daae9b4..9b098853a 100644 --- a/src/xenia/kernel/content_manager.cc +++ b/src/xenia/kernel/content_manager.cc @@ -81,7 +81,7 @@ std::wstring ContentManager::ResolvePackageRoot(uint32_t content_type) { // content_root/title_id/type_name/ auto package_root = xe::join_paths(root_path_, xe::join_paths(title_id, type_name)); - return package_root + xe::wpath_separator; + return package_root + xe::kWPathSeparator; } std::wstring ContentManager::ResolvePackagePath(const XCONTENT_DATA& data) { @@ -90,7 +90,7 @@ std::wstring ContentManager::ResolvePackagePath(const XCONTENT_DATA& data) { auto package_root = ResolvePackageRoot(data.content_type); auto package_path = xe::join_paths(package_root, xe::to_wstring(data.file_name)); - package_path += xe::path_separator; + package_path += xe::kPathSeparator; return package_path; } diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc index 5551a4ea3..cc466fe0b 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam_net.cc @@ -593,9 +593,11 @@ SHIM_CALL NetDll_select_shim(PPCContext* ppc_context, timeval* timeout_in = nullptr; timeval timeout; if (timeout_ptr) { - timeout = {static_cast(SHIM_MEM_32(timeout_ptr + 0)), - static_cast(SHIM_MEM_32(timeout_ptr + 4))}; - Clock::ScaleGuestDurationTimeval(&timeout.tv_sec, &timeout.tv_usec); + timeout = {static_cast(SHIM_MEM_32(timeout_ptr + 0)), + static_cast(SHIM_MEM_32(timeout_ptr + 4))}; + Clock::ScaleGuestDurationTimeval( + reinterpret_cast(&timeout.tv_sec), + reinterpret_cast(&timeout.tv_usec)); timeout_in = &timeout; } int ret = select(nfds, readfds_ptr ? &readfds : nullptr,