More style cleanup.

This commit is contained in:
Ben Vanik
2015-08-06 20:17:01 -07:00
parent e6461f326c
commit 5e08889d93
76 changed files with 418 additions and 420 deletions

View File

@@ -14,12 +14,6 @@
#include "xenia/base/platform.h"
#if XE_PLATFORM_MAC
#include <libkern/OSAtomic.h>
#elif XE_PLATFORM_WIN32
#include <intrin.h>
#endif // XE_PLATFORM_MAC
namespace xe {
// These functions are modeled off of the Apple OSAtomic routines

View File

@@ -77,8 +77,8 @@ inline T byte_swap(T value) {
template <typename T>
struct be {
be() = default;
be(const T& src) : value(xe::byte_swap(src)) {}
be(const be& other) { value = other.value; }
be(const T& src) : value(xe::byte_swap(src)) {} // NOLINT(runtime/explicit)
be(const be& other) { value = other.value; } // NOLINT(runtime/explicit)
operator T() const { return xe::byte_swap(value); }
be<T>& operator+=(int a) {

View File

@@ -25,7 +25,7 @@ bool has_console_attached();
struct EntryInfo {
std::wstring name;
std::wstring usage;
int (*entry_point)(std::vector<std::wstring>& args);
int (*entry_point)(const std::vector<std::wstring>& args);
};
EntryInfo GetEntryInfo();

View File

@@ -64,10 +64,10 @@ int Main() {
// Convert all args to narrow, as gflags doesn't support wchar.
int argca = argc;
char** argva = (char**)alloca(sizeof(char*) * argca);
char** argva = reinterpret_cast<char**>(alloca(sizeof(char*) * argca));
for (int n = 0; n < argca; n++) {
size_t len = wcslen(argv[n]);
argva[n] = (char*)alloca(len + 1);
argva[n] = reinterpret_cast<char*>(alloca(len + 1));
wcstombs_s(nullptr, argva[n], len + 1, argv[n], _TRUNCATE);
}
@@ -110,17 +110,17 @@ int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR command_line, int) {
#if defined _M_IX86
#pragma comment( \
linker, \
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
#elif defined _M_IA64
#pragma comment( \
linker, \
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
#elif defined _M_X64
#pragma comment( \
linker, \
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
#else
#pragma comment( \
linker, \
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
#endif

View File

@@ -86,7 +86,6 @@ std::unique_ptr<MappedMemory> MappedMemory::Open(const std::wstring& path,
mm->mapping_handle = CreateFileMapping(mm->file_handle, nullptr,
mapping_protect, 0, 0, nullptr);
//(DWORD)(aligned_length >> 32), (DWORD)(aligned_length & 0xFFFFFFFF), NULL);
if (!mm->mapping_handle) {
return nullptr;
}
@@ -156,7 +155,7 @@ class Win32ChunkedMappedMemoryWriter : public ChunkedMappedMemoryWriter {
private:
class Chunk {
public:
Chunk(size_t capacity)
explicit Chunk(size_t capacity)
: file_handle_(0),
mapping_handle_(0),
data_(nullptr),

View File

@@ -16,7 +16,7 @@ namespace xe {
// Copyright (c) Microsoft Corporation. All rights reserved.
uint16_t float_to_half(float value) {
uint32_t Result;
uint32_t IValue = ((uint32_t*)(&value))[0];
uint32_t IValue = (reinterpret_cast<uint32_t*>(&value))[0];
uint32_t Sign = (IValue & 0x80000000U) >> 16U;
IValue = IValue & 0x7FFFFFFFU; // Hack off the sign
if (IValue > 0x47FFEFFFU) {
@@ -63,7 +63,7 @@ float half_to_float(uint16_t value) {
uint32_t Result = ((value & 0x8000) << 16) | // Sign
((Exponent + 112) << 23) | // Exponent
(Mantissa << 13); // Mantissa
return *(float*)&Result;
return *reinterpret_cast<float*>(&Result);
}
} // namespace xe

View File

@@ -14,10 +14,11 @@
#include "xenia/base/logging.h"
// winsock includes must come after platform_win.h:
#include "xenia/base/platform_win.h"
#include <mstcpip.h> // NOLINT(must follow platform_win.h)
#include <winsock2.h> // NOLINT(must follow platform_win.h)
#include <ws2tcpip.h> // NOLINT(must follow platform_win.h)
#include <mstcpip.h> // NOLINT(build/include_order)
#include <winsock2.h> // NOLINT(build/include_order)
#include <ws2tcpip.h> // NOLINT(build/include_order)
namespace xe {