summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2017-06-07 04:16:02 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2017-06-07 19:52:07 -0700
commite1a3e41bf33bf6a366760ede17c2e3bd2b106116 (patch)
treea2d6b34b5603794a24c0e6acd998e52d6313aeb0 /Source/Core
parentbe7c6a081918ac2240f6a2e4e51ca6e3daa0f032 (diff)
fix various instances of -1 being assigned to unsigned types
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/FileUtil.cpp2
-rw-r--r--Source/Core/Common/MathUtil.h2
-rw-r--r--Source/Core/Common/Profiler.cpp6
-rw-r--r--Source/Core/Common/Thread.cpp9
-rw-r--r--Source/Core/Core/Debugger/Dump.cpp4
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp2
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.cpp4
-rw-r--r--Source/Core/DiscIO/CISOBlob.h2
-rw-r--r--Source/Core/DiscIO/VolumeDirectory.cpp2
-rw-r--r--Source/Core/DiscIO/VolumeWii.cpp3
-rw-r--r--Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp2
-rw-r--r--Source/Core/VideoBackends/OGL/TextureCache.cpp8
-rw-r--r--Source/Core/VideoCommon/IndexGenerator.cpp2
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp2
-rw-r--r--Source/Core/VideoCommon/VertexLoaderBase.h2
15 files changed, 25 insertions, 27 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index ebab9e9c48..2ae063673f 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -986,7 +986,7 @@ u64 IOFile::Tell() const
if (IsOpen())
return ftello(m_file);
else
- return -1;
+ return UINT64_MAX;
}
bool IOFile::Flush()
diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h
index 7e48e38d80..becaf09792 100644
--- a/Source/Core/Common/MathUtil.h
+++ b/Source/Core/Common/MathUtil.h
@@ -198,7 +198,7 @@ inline int IntLog2(u64 val)
return 63 - __builtin_clzll(val);
#elif defined(_MSC_VER)
- unsigned long result = -1;
+ unsigned long result = ULONG_MAX;
_BitScanReverse64(&result, val);
return result;
diff --git a/Source/Core/Common/Profiler.cpp b/Source/Core/Common/Profiler.cpp
index fdc356a164..0be14073bd 100644
--- a/Source/Core/Common/Profiler.cpp
+++ b/Source/Core/Common/Profiler.cpp
@@ -29,8 +29,8 @@ std::string Profiler::s_lazy_result = "";
int Profiler::s_lazy_delay = 0;
Profiler::Profiler(const std::string& name)
- : m_name(name), m_usecs(0), m_usecs_min(-1), m_usecs_max(0), m_usecs_quad(0), m_calls(0),
- m_depth(0)
+ : m_name(name), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0),
+ m_calls(0), m_depth(0)
{
m_time = Common::Timer::GetTimeUs();
s_max_length = std::max<u32>(s_max_length, u32(m_name.length()));
@@ -154,7 +154,7 @@ std::string Profiler::Read()
buffer << std::setw(PROFILER_FIELD_LENGTH) << std::right << m_usecs_max;
m_usecs = 0;
- m_usecs_min = -1;
+ m_usecs_min = UINT64_MAX;
m_usecs_max = 0;
m_usecs_quad = 0;
m_calls = 0;
diff --git a/Source/Core/Common/Thread.cpp b/Source/Core/Common/Thread.cpp
index 190653ee31..fa81314795 100644
--- a/Source/Core/Common/Thread.cpp
+++ b/Source/Core/Common/Thread.cpp
@@ -62,11 +62,8 @@ void SwitchCurrentThread()
}
// Sets the debugger-visible name of the current thread.
-// Uses undocumented (actually, it is now documented) trick.
-// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp
-
-// This is implemented much nicer in upcoming msvc++, see:
-// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx
+// Uses trick documented in:
+// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
void SetCurrentThreadName(const char* szThreadName)
{
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
@@ -83,7 +80,7 @@ void SetCurrentThreadName(const char* szThreadName)
info.dwType = 0x1000;
info.szName = szThreadName;
- info.dwThreadID = -1; // dwThreadID;
+ info.dwThreadID = static_cast<DWORD>(-1);
info.dwFlags = 0;
__try
diff --git a/Source/Core/Core/Debugger/Dump.cpp b/Source/Core/Core/Debugger/Dump.cpp
index 45f8fde926..a7ee736caf 100644
--- a/Source/Core/Core/Debugger/Dump.cpp
+++ b/Source/Core/Core/Debugger/Dump.cpp
@@ -42,7 +42,7 @@ u32 CDump::GetGPR(int _step, int _gpr)
u32 offset = _step * STRUCTUR_SIZE;
if (offset >= m_size)
- return -1;
+ return UINT32_MAX;
return Read32(offset + OFFSET_GPR + (_gpr * 4));
}
@@ -52,7 +52,7 @@ u32 CDump::GetPC(int _step)
u32 offset = _step * STRUCTUR_SIZE;
if (offset >= m_size)
- return -1;
+ return UINT32_MAX;
return Read32(offset + OFFSET_PC);
}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
index 480ee662da..65b8547b98 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
@@ -495,7 +495,7 @@ void Interpreter::divwx(UGeckoInstruction inst)
}
if (((u32)a & 0x80000000) && b == 0)
- rGPR[inst.RD] = -1;
+ rGPR[inst.RD] = UINT32_MAX;
else
rGPR[inst.RD] = 0;
}
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 733bf6d3b1..c34cfd72fc 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -730,8 +730,8 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32
code[i].opinfo = opinfo;
code[i].address = address;
code[i].inst = inst;
- code[i].branchTo = -1;
- code[i].branchToIndex = -1;
+ code[i].branchTo = UINT32_MAX;
+ code[i].branchToIndex = UINT32_MAX;
code[i].skip = false;
block->m_stats->numCycles += opinfo->numCycles;
block->m_physical_addresses.insert(result.physical_address);
diff --git a/Source/Core/DiscIO/CISOBlob.h b/Source/Core/DiscIO/CISOBlob.h
index b674dedc18..a1c8c97b40 100644
--- a/Source/Core/DiscIO/CISOBlob.h
+++ b/Source/Core/DiscIO/CISOBlob.h
@@ -48,7 +48,7 @@ private:
CISOFileReader(File::IOFile file);
typedef u16 MapType;
- static const MapType UNUSED_BLOCK_ID = -1;
+ static const MapType UNUSED_BLOCK_ID = UINT16_MAX;
File::IOFile m_file;
u64 m_size;
diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp
index ed965983e6..f6f603d8ff 100644
--- a/Source/Core/DiscIO/VolumeDirectory.cpp
+++ b/Source/Core/DiscIO/VolumeDirectory.cpp
@@ -35,7 +35,7 @@ const size_t VolumeDirectory::MAX_ID_LENGTH;
VolumeDirectory::VolumeDirectory(const std::string& directory, bool is_wii,
const std::string& apploader, const std::string& dol)
- : m_data_start_address(-1), m_disk_header(DISKHEADERINFO_ADDRESS),
+ : m_data_start_address(UINT64_MAX), m_disk_header(DISKHEADERINFO_ADDRESS),
m_disk_header_info(std::make_unique<SDiskHeaderInfo>()), m_fst_address(0), m_dol_address(0)
{
m_root_directory = ExtractDirectoryName(directory);
diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp
index f928bbcdf3..4b6ef56539 100644
--- a/Source/Core/DiscIO/VolumeWii.cpp
+++ b/Source/Core/DiscIO/VolumeWii.cpp
@@ -32,7 +32,8 @@ namespace DiscIO
constexpr u64 PARTITION_DATA_OFFSET = 0x20000;
VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
- : m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE), m_last_decrypted_block(-1)
+ : m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE),
+ m_last_decrypted_block(UINT64_MAX)
{
_assert_(m_pReader);
diff --git a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
index 922fd3c0c7..8c4be0c3f4 100644
--- a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
@@ -32,7 +32,7 @@ static DSPDebuggerLLE* m_DebuggerFrame = nullptr;
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("DSP LLE Debugger")),
- m_CachedStepCounter(-1), m_toolbar_item_size(FromDIP(wxSize(16, 16)))
+ m_CachedStepCounter(UINT64_MAX), m_toolbar_item_size(FromDIP(wxSize(16, 16)))
{
Bind(wxEVT_MENU, &DSPDebuggerLLE::OnChangeState, this, ID_RUNTOOL, ID_SHOWPCTOOL);
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp
index 2031d7e220..169dec0bc5 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp
@@ -370,9 +370,9 @@ TextureCache::TextureCache()
{
CompileShaders();
- s_ActiveTexture = -1;
+ s_ActiveTexture = UINT32_MAX;
for (auto& gtex : s_Textures)
- gtex = -1;
+ gtex = UINT32_MAX;
if (g_ActiveConfig.backend_info.bSupportsPaletteConversion)
{
@@ -519,8 +519,8 @@ bool TextureCache::CompileShaders()
s_ColorMatrixUniform = glGetUniformLocation(s_ColorMatrixProgram.glprogid, "colmat");
s_DepthMatrixUniform = glGetUniformLocation(s_DepthMatrixProgram.glprogid, "colmat");
- s_ColorCbufid = -1;
- s_DepthCbufid = -1;
+ s_ColorCbufid = UINT32_MAX;
+ s_DepthCbufid = UINT32_MAX;
s_ColorCopyPositionUniform = glGetUniformLocation(s_ColorCopyProgram.glprogid, "copy_position");
s_ColorMatrixPositionUniform =
diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp
index 79dbc92597..74f6a8a728 100644
--- a/Source/Core/VideoCommon/IndexGenerator.cpp
+++ b/Source/Core/VideoCommon/IndexGenerator.cpp
@@ -16,7 +16,7 @@ u16* IndexGenerator::index_buffer_current;
u16* IndexGenerator::BASEIptr;
u32 IndexGenerator::base_index;
-static const u16 s_primitive_restart = -1;
+static const u16 s_primitive_restart = UINT16_MAX;
static u16* (*primitive_table[8])(u16*, u32, u32);
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 613f2dfed9..72978f6752 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -994,7 +994,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
float* const ColorMask = colmat + 20;
ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 255.0f;
ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 255.0f;
- unsigned int cbufid = -1;
+ unsigned int cbufid = UINT_MAX;
u32 srcFormat = bpmem.zcontrol.pixel_format;
bool efbHasAlpha = srcFormat == PEControl::RGBA6_Z24;
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h
index a895300466..509ccb4310 100644
--- a/Source/Core/VideoCommon/VertexLoaderBase.h
+++ b/Source/Core/VideoCommon/VertexLoaderBase.h
@@ -36,7 +36,7 @@ public:
private:
size_t CalculateHash() const
{
- size_t h = -1;
+ size_t h = SIZE_MAX;
for (auto word : vid)
{