From 39a4d4329dd335cb46900e029bac7a7719a88a31 Mon Sep 17 00:00:00 2001
From: Jordan Cristiano <jordan.cristi@gmail.com>
Date: Thu, 14 Nov 2013 02:19:15 -0500
Subject: [PATCH] more warning fixes

---
 .../Core/Core/Src/FifoPlayer/FifoDataFile.cpp |  4 +-
 .../Src/FifoPlayer/FifoPlaybackAnalyzer.cpp   |  2 +-
 .../Core/Core/Src/FifoPlayer/FifoPlayer.cpp   | 10 ++--
 .../Core/Core/Src/FifoPlayer/FifoRecorder.cpp |  6 +--
 Source/Core/Core/Src/HW/DVDInterface.cpp      |  2 +-
 .../Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp |  2 +-
 Source/Core/Core/Src/HW/GCMemcard.cpp         |  4 +-
 Source/Core/Core/Src/HW/GCPadEmu.cpp          |  2 +-
 .../Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp |  4 +-
 .../Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp     |  2 +-
 .../Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h  |  4 +-
 Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 10 ++--
 .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp   |  8 ++-
 .../Core/Src/HW/WiimoteReal/WiimoteReal.h     |  2 +-
 Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp  |  6 ++-
 .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp     |  2 +-
 .../Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp     |  2 +-
 .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp    |  2 +-
 Source/Core/Core/Src/NetPlayClient.cpp        |  9 ++--
 Source/Core/Core/Src/NetPlayServer.cpp        |  6 ++-
 .../Src/PowerPC/JitCommon/JitBackpatch.cpp    |  2 +-
 .../Core/Src/PowerPC/JitCommon/Jit_Util.cpp   |  2 +-
 Source/Core/Core/Src/PowerPC/PPCTables.cpp    |  2 +-
 Source/Core/Core/Src/State.cpp                |  8 ++-
 .../Src/ControllerInterface/SDL/SDL.cpp       | 52 ++++++++++---------
 .../Core/VideoBackends/OGL/Src/RasterFont.cpp |  2 +-
 .../VideoCommon/Src/x64TextureDecoder.cpp     |  2 +-
 27 files changed, 89 insertions(+), 70 deletions(-)

diff --git a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp
index 118511af92..5e7e864ad0 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp
+++ b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp
@@ -86,7 +86,7 @@ bool FifoDataFile::Save(const char *filename)
 	header.xfRegsSize = XF_REGS_SIZE;
 
 	header.frameListOffset = frameListOffset;
-	header.frameCount = m_Frames.size();
+	header.frameCount = (u32)m_Frames.size();
 
 	header.flags = m_Flags;
 
@@ -111,7 +111,7 @@ bool FifoDataFile::Save(const char *filename)
 		dstFrame.fifoStart = srcFrame.fifoStart;
 		dstFrame.fifoEnd = srcFrame.fifoEnd;
 		dstFrame.memoryUpdatesOffset = memoryUpdatesOffset;
-		dstFrame.numMemoryUpdates = srcFrame.memoryUpdates.size();
+		dstFrame.numMemoryUpdates = (u32)srcFrame.memoryUpdates.size();
 
 		// Write frame info
 		u64 frameOffset = frameListOffset + (i * sizeof(FileFrameInfo));
diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp
index 1e606e52e4..e6adc14130 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp
+++ b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp
@@ -234,7 +234,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
 		break;
 	}
 
-	return data - dataStart;
+	return (u32)(data - dataStart);
 }
 
 void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
index 0f65c6a966..8aaf962999 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
+++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
@@ -105,7 +105,9 @@ bool FifoPlayer::Play()
 u32 FifoPlayer::GetFrameObjectCount()
 {
 	if (m_CurrentFrame < m_FrameInfo.size())
-		return m_FrameInfo[m_CurrentFrame].objectStarts.size();
+	{
+		return (u32)(m_FrameInfo[m_CurrentFrame].objectStarts.size());
+	}
 
 	return 0;
 }
@@ -172,7 +174,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
 	m_FrameFifoSize = frame.fifoDataSize;
 
 	// Determine start and end objects
-	u32 numObjects = info.objectStarts.size();
+	u32 numObjects = (u32)(info.objectStarts.size());
 	u32 drawStart = std::min(numObjects, m_ObjectRangeStart);
 	u32 drawEnd = std::min(numObjects - 1, m_ObjectRangeEnd);
 
@@ -181,7 +183,9 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
 
 	// Skip memory updates during frame if true
 	if (m_EarlyMemoryUpdates)
-		memoryUpdate = frame.memoryUpdates.size();
+	{
+		memoryUpdate = (u32)(frame.memoryUpdates.size());
+	}
 
 	if (numObjects > 0)
 	{
diff --git a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp
index fb98205d27..e58b34658a 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp
+++ b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp
@@ -83,9 +83,9 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
 	if (m_FrameEnded && m_FifoData.size() > 0)
 	{
 		size_t dataSize = m_FifoData.size();
-		m_CurrentFrame.fifoDataSize = dataSize;
+		m_CurrentFrame.fifoDataSize = (u32)dataSize;
 		m_CurrentFrame.fifoData = new u8[dataSize];
-		memcpy(m_CurrentFrame.fifoData, &m_FifoData[0], dataSize);
+		memcpy(m_CurrentFrame.fifoData, m_FifoData.data(), dataSize);
 
 		sMutex.lock();
 
@@ -129,7 +129,7 @@ void FifoRecorder::WriteMemory(u32 address, u32 size, MemoryUpdate::Type type)
 		// Record memory update
 		MemoryUpdate memUpdate;
 		memUpdate.address = address;
-		memUpdate.fifoPosition = m_FifoData.size();
+		memUpdate.fifoPosition = (u32)(m_FifoData.size());
 		memUpdate.size = size;
 		memUpdate.type = type;
 		memUpdate.data = new u8[size];
diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp
index fc326fec90..d77fa4877f 100644
--- a/Source/Core/Core/Src/HW/DVDInterface.cpp
+++ b/Source/Core/Core/Src/HW/DVDInterface.cpp
@@ -325,7 +325,7 @@ void ChangeDisc(const char* _newFileName)
 	{
 		Movie::g_bDiscChange = true;
 		std::string fileName = _newFileName;
-		int sizeofpath = fileName.find_last_of("/\\") + 1;
+		auto sizeofpath = fileName.find_last_of("/\\") + 1;
 		if (fileName.substr(sizeofpath).length() > 40)
 		{
 			PanicAlert("Saving iso filename to .dtm failed; max file name length is 40 characters.");
diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
index 1cdeb1fbcf..2d1fb56c2a 100644
--- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
+++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp
@@ -191,7 +191,7 @@ void CEXIMemoryCard::CmdDone()
 void CEXIMemoryCard::CmdDoneLater(u64 cycles)
 {
 	CoreTiming::RemoveEvent(et_cmd_done);
-	CoreTiming::ScheduleEvent(cycles, et_cmd_done, (u64)card_index);
+	CoreTiming::ScheduleEvent((int)cycles, et_cmd_done, (u64)card_index);
 }
 
 void CEXIMemoryCard::SetCS(int cs)
diff --git a/Source/Core/Core/Src/HW/GCMemcard.cpp b/Source/Core/Core/Src/HW/GCMemcard.cpp
index adaa7a1858..2421e572ae 100644
--- a/Source/Core/Core/Src/HW/GCMemcard.cpp
+++ b/Source/Core/Core/Src/HW/GCMemcard.cpp
@@ -40,7 +40,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
 			PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
 			return;
 		}
-		u32 size = mcdFile.GetSize();
+		auto size = mcdFile.GetSize();
 		if (size < MC_FST_BLOCKS*BLOCK_SIZE)
 		{
 			PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, size);
@@ -52,7 +52,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
 				return;
 		}
 
-		m_sizeMb = (size/BLOCK_SIZE) / MBIT_TO_BLOCKS;
+		m_sizeMb = (u16)((size/BLOCK_SIZE) / MBIT_TO_BLOCKS);
 		switch (m_sizeMb)
 		{
 			case MemCard59Mb:
diff --git a/Source/Core/Core/Src/HW/GCPadEmu.cpp b/Source/Core/Core/Src/HW/GCPadEmu.cpp
index 28c33ae926..80fc48b9db 100644
--- a/Source/Core/Core/Src/HW/GCPadEmu.cpp
+++ b/Source/Core/Core/Src/HW/GCPadEmu.cpp
@@ -209,5 +209,5 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
 
 bool GCPad::GetMicButton() const
 {
-	return m_buttons->controls.back()->control_ref->State();
+	return (0 != m_buttons->controls.back()->control_ref->State());
 }
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp
index 235d5cb7f1..2014f0b1f4 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp
@@ -32,7 +32,7 @@
 namespace WiimoteEmu
 {
 
-void Spy(Wiimote* wm_, const void* data_, int size_)
+void Spy(Wiimote* wm_, const void* data_, size_t size_)
 {
 #if 0
 	// enable log
@@ -1275,7 +1275,7 @@ void Wiimote::DoState(PointerWrap& p)
 		else
 		{
 			std::queue<ReadRequest> tmp_queue(m_read_requests);
-			size = m_read_requests.size();
+			size = (u32)(m_read_requests.size());
 			p.Do(size);
 			while (!tmp_queue.empty())
 			{
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
index 28f60940c4..4c80b1adda 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -765,7 +765,7 @@ void Wiimote::Update()
 					if (-1 == rptf_size)
 					{
 						std::copy(rpt.begin(), rpt.end(), data);
-						rptf_size = rpt.size();
+						rptf_size = (s8)(rpt.size());
 					}
 				}
 			}
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
index 9ed58f8b48..f2afda4aa3 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
@@ -96,7 +96,7 @@ inline double trim(double a)
 class Wiimote : public ControllerEmu
 {
 friend class WiimoteReal::Wiimote;
-friend void Spy(Wiimote* wm_, const void* data_, int size_);
+friend void Spy(Wiimote* wm_, const void* data_, size_t size_);
 public:
 
 	enum
@@ -245,7 +245,7 @@ private:
 	}	m_reg_speaker;
 };
 
-void Spy(Wiimote* wm_, const void* data_, int size_);
+void Spy(Wiimote* wm_, const void* data_, size_t size_);
 
 }
 
diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
index 2f1efd0228..13728a9d72 100644
--- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
@@ -140,7 +140,7 @@ namespace WiimoteReal
 {
 
 
-int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len);
+int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len);
 int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index);
 void _IOWakeup(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read);
 
@@ -247,7 +247,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
 	//	SLEEP(2000);
 
 }
-int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, int size, int attempts)
+int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
 {
 	OVERLAPPED hid_overlap_write = OVERLAPPED();
 	hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL);
@@ -641,7 +641,7 @@ int Wiimote::IORead(u8* buf)
 }
 
 
-int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len)
+int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len)
 {
 	WiimoteEmu::Spy(NULL, buf, len);
 
@@ -663,7 +663,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
 		}
 		case MSBT_STACK_MS:
 		{
-			auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, len - 1);
+			auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, (ULONG)(len - 1));
 			//FlushFileBuffers(dev_handle);
 
 			if (!result)
@@ -715,7 +715,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
 	return 0;
 }
 
-int Wiimote::IOWrite(const u8* buf, int len)
+int Wiimote::IOWrite(const u8* buf, size_t len)
 {
 	return _IOWrite(dev_handle, hid_overlap_write, stack, buf, len);
 }
diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
index e5fff5b3f1..dea6f7fce6 100644
--- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
@@ -239,7 +239,9 @@ bool Wiimote::Write()
 			IOWrite(rpt.data(), rpt.size());
 
 			if (is_speaker_data)
+			{
 				m_last_audio_report.Update();
+			}
 
 			m_write_reports.Pop();
 			return true;
@@ -293,8 +295,10 @@ void Wiimote::Update()
 
 	// Send the report
 	if (!rpt.empty() && m_channel > 0)
-		Core::Callback_WiimoteInterruptChannel(index, m_channel,
-			rpt.data(), rpt.size());
+	{
+		Core::Callback_WiimoteInterruptChannel(index, m_channel, 
+			rpt.data(), (u32)rpt.size());
+	}
 }
 
 void Wiimote::Prepare(int _index)
diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h
index c4807ed95f..bc953102a9 100644
--- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h
+++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h
@@ -106,7 +106,7 @@ private:
 	void WriteReport(Report rpt);
 
 	int IORead(u8* buf);
-	int IOWrite(u8 const* buf, int len);
+	int IOWrite(u8 const* buf, size_t len);
 	void IOWakeup();
 
 	void ThreadFunc();
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
index 22115e4900..3bd37ba373 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
@@ -83,7 +83,7 @@ static u64 last_reply_time;
 void EnqueReplyCallback(u64 userdata, int)
 {
 	std::lock_guard<std::mutex> lk(s_reply_queue);
-	reply_queue.push_back(userdata);
+	reply_queue.push_back((u32)userdata);
 }
 
 void Init()
@@ -546,7 +546,9 @@ void ExecuteCommand(u32 _Address)
 		const s64 ticks_til_last_reply = last_reply_time - CoreTiming::GetTicks();
 
 		if (ticks_til_last_reply > 0)
-			reply_delay = ticks_til_last_reply;
+		{
+			reply_delay = (int)ticks_til_last_reply;
+		}
 
 		last_reply_time = CoreTiming::GetTicks() + reply_delay;
 
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
index 58ff0917ed..ea4230f485 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
@@ -133,7 +133,7 @@ void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
 	p.Do(m_AccessIdentID);
 	p.Do(m_TitleIDs);
 
-	u32 Count = m_ContentAccessMap.size();
+	u32 Count = (u32)(m_ContentAccessMap.size());
 	p.Do(Count);
 
 	u32 CFD, Position;
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
index edbcc0967a..4de7af8e06 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
@@ -571,7 +571,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
 			}
 			else
 			{
-				u32 size = entry.size;
+				u32 size = (u32)entry.size;
 				p.Do(size);
 
 				File::IOFile handle(entry.physicalName, "rb");
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
index 990a9e6a7d..aa7d84d661 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
@@ -866,7 +866,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool
 
 bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
 {
-	SQueuedEvent Event(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size(), 0);
+	SQueuedEvent Event((u32)(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + (sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size())), 0);
 
 	INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
 
diff --git a/Source/Core/Core/Src/NetPlayClient.cpp b/Source/Core/Core/Src/NetPlayClient.cpp
index 7e71584c35..6ca13b4836 100644
--- a/Source/Core/Core/Src/NetPlayClient.cpp
+++ b/Source/Core/Core/Src/NetPlayClient.cpp
@@ -445,10 +445,11 @@ void NetPlayClient::SendWiimoteState(const PadMapping in_game_pad, const NetWiim
 	sf::Packet spac;
 	spac << (MessageId)NP_MSG_WIIMOTE_DATA;
 	spac << in_game_pad;
-	u8 size = nw.size();
-	spac << size;
-	for (unsigned int i = 0; i < size; ++i)
-		spac << nw.data()[i];
+	spac << (u8)nw.size();
+	for (auto it : nw)
+	{
+		spac << it;
+	}
 
 	std::lock_guard<std::recursive_mutex> lks(m_crit.send);
 	m_socket.Send(spac);
diff --git a/Source/Core/Core/Src/NetPlayServer.cpp b/Source/Core/Core/Src/NetPlayServer.cpp
index 0049719a05..296fcd29a4 100644
--- a/Source/Core/Core/Src/NetPlayServer.cpp
+++ b/Source/Core/Core/Src/NetPlayServer.cpp
@@ -153,7 +153,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
 	rpac >> player.name;
 
 	// give new client first available id
-	player.pid = m_players.size() + 1;
+	player.pid = (PlayerId)(m_players.size() + 1);
 
 	// try to automatically assign new user a pad
 	for (unsigned int m = 0; m < 4; ++m)
@@ -435,12 +435,14 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
 
 	case NP_MSG_PONG :
 		{
-			const u32 ping = m_ping_timer.GetTimeElapsed();
+			const u32 ping = (u32)m_ping_timer.GetTimeElapsed();
 			u32 ping_key = 0;
 			packet >> ping_key;
 
 			if (m_ping_key == ping_key)
+			{
 				player.ping = ping;
+			}
 
 			sf::Packet spac;
 			spac << (MessageId)NP_MSG_PLAYER_PING_DATA;
diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
index dd481da9bc..b7cc031c99 100644
--- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
+++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
@@ -234,7 +234,7 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
 		XEmitter emitter(start);
 		const u8 *trampoline = trampolines.GetWriteTrampoline(info, registersInUse);
 		emitter.CALL((void *)trampoline);
-		emitter.NOP(codePtr + info.instructionSize - emitter.GetCodePtr());
+		emitter.NOP((int)(codePtr + info.instructionSize - emitter.GetCodePtr()));
 		return start;
 	}
 #else
diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
index 00e24e7a20..5c4a712024 100644
--- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
+++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
@@ -323,7 +323,7 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce
 	MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write
 	TEST(32, R(reg_addr), Imm32(mem_mask));
 	FixupBranch fast = J_CC(CC_Z, true);
-	bool noProlog = flags & SAFE_LOADSTORE_NO_PROLOG;
+	bool noProlog = (0 != (flags & SAFE_LOADSTORE_NO_PROLOG));
 	bool swap = !(flags & SAFE_LOADSTORE_NO_SWAP);
 	ABI_PushRegistersAndAdjustStack(registersInUse, noProlog);
 	switch (accessSize)
diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp
index d901f639e5..625e416299 100644
--- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp
+++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp
@@ -192,7 +192,7 @@ void PrintInstructionRunCounts()
 	{
 		op_inf x;
 		x.name = m_allInstructions[i]->opname;
-		x.count = m_allInstructions[i]->runCount;
+		x.count = (int)(m_allInstructions[i]->runCount);
 		temp.push_back(x);
 	}
 	std::sort(temp.begin(), temp.end());
diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp
index 99a1236123..f33003fdb1 100644
--- a/Source/Core/Core/Src/State.cpp
+++ b/Source/Core/Core/Src/State.cpp
@@ -247,7 +247,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
 	// Setting up the header
 	StateHeader header;
 	memcpy(header.gameID, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), 6);
-	header.size = g_use_compression ? buffer_size : 0;
+	header.size = g_use_compression ? (u32)buffer_size : 0;
 	header.time = Common::Timer::GetDoubleTime();
 
 	f.WriteArray(&header, 1);
@@ -261,9 +261,13 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
 			lzo_uint out_len = 0;
 
 			if ((i + IN_LEN) >= buffer_size)
-				cur_len = buffer_size - i;
+			{
+				cur_len = (lzo_uint32)(buffer_size - i);
+			}
 			else
+			{
 				cur_len = IN_LEN;
+			}
 
 			if (lzo1x_1_compress(buffer_data + i, cur_len, out, &out_len, wrkmem) != LZO_E_OK)
 				PanicAlertT("Internal LZO Error - compression failed");
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
index bcd3586dc6..24e0d0de58 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
@@ -154,12 +154,13 @@ Joystick::~Joystick()
 	{
 		// stop/destroy all effects
 		SDL_HapticStopAll(m_haptic);
-		std::list<EffectIDState>::iterator
-			i = m_state_out.begin(),
-			e = m_state_out.end();
-		for ( ; i != e; ++i)
-			if (i->id != -1)
-				SDL_HapticDestroyEffect(m_haptic, i->id);
+		for (auto &i : m_state_out)
+		{
+			if (i.id != -1)
+			{
+				SDL_HapticDestroyEffect(m_haptic, i.id);
+			}
+		}
 		// close haptic first
 		SDL_HapticClose(m_haptic);
 	}
@@ -210,7 +211,7 @@ void Joystick::ConstantEffect::SetState(ControlState state)
 	}
 
 	const Sint16 old = m_effect.effect.constant.level;
-	m_effect.effect.constant.level = state * 0x7FFF;
+	m_effect.effect.constant.level = (Sint16)(state * 0x7FFF);
 	if (old != m_effect.effect.constant.level)
 		m_effect.changed = true;
 }
@@ -228,7 +229,7 @@ void Joystick::RampEffect::SetState(ControlState state)
 	}
 
 	const Sint16 old = m_effect.effect.ramp.start;
-	m_effect.effect.ramp.start = state * 0x7FFF;
+	m_effect.effect.ramp.start = (Sint16)(state * 0x7FFF);
 	if (old != m_effect.effect.ramp.start)
 		m_effect.changed = true;
 }
@@ -247,7 +248,7 @@ void Joystick::SineEffect::SetState(ControlState state)
 
 	const Sint16 old = m_effect.effect.periodic.magnitude;
 	m_effect.effect.periodic.period = 5;
-	m_effect.effect.periodic.magnitude = state * 0x5000;
+	m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
 	m_effect.effect.periodic.attack_length = 0;
 	m_effect.effect.periodic.fade_length = 500;
 
@@ -293,7 +294,7 @@ void Joystick::TriangleEffect::SetState(ControlState state)
 
 	const Sint16 old = m_effect.effect.periodic.magnitude;
 	m_effect.effect.periodic.period = 5;
-	m_effect.effect.periodic.magnitude = state * 0x5000;
+	m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
 	m_effect.effect.periodic.attack_length = 0;
 	m_effect.effect.periodic.fade_length = 100;
 
@@ -313,34 +314,35 @@ bool Joystick::UpdateInput()
 bool Joystick::UpdateOutput()
 {
 #ifdef USE_SDL_HAPTIC
-	std::list<EffectIDState>::iterator
-		i = m_state_out.begin(),
-		e = m_state_out.end();
-	for ( ; i != e; ++i)
+	for (auto &i : m_state_out)
 	{
-		if (i->changed)	// if SetState was called on this output
+		if (i.changed)	// if SetState was called on this output
 		{
-			if (-1 == i->id)	// effect isn't currently uploaded
+			if (-1 == i.id)	// effect isn't currently uploaded
 			{
-				if (i->effect.type)		// if outputstate is >0  this would be true
-					if ((i->id = SDL_HapticNewEffect( m_haptic, &i->effect )) > -1)	// upload the effect
-						SDL_HapticRunEffect(m_haptic, i->id, 1);	// run the effect
+				if (i.effect.type)		// if outputstate is >0  this would be true
+				{
+					if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1)	// upload the effect
+					{
+						SDL_HapticRunEffect(m_haptic, i.id, 1);	// run the effect
+					}
+				}
 			}
 			else	// effect is already uploaded
 			{
-				if (i->effect.type)	// if ouputstate >0
+				if (i.effect.type)	// if ouputstate >0
 				{
-					SDL_HapticUpdateEffect(m_haptic, i->id, &i->effect);	// update the effect
+					SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect);	// update the effect
 				}
 				else
 				{
-					SDL_HapticStopEffect(m_haptic, i->id);	// else, stop and remove the effect
-					SDL_HapticDestroyEffect(m_haptic, i->id);
-					i->id = -1;	// mark it as not uploaded
+					SDL_HapticStopEffect(m_haptic, i.id);	// else, stop and remove the effect
+					SDL_HapticDestroyEffect(m_haptic, i.id);
+					i.id = -1;	// mark it as not uploaded
 				}
 			}
 
-			i->changed = false;
+			i.changed = false;
 		}
 	}
 #endif
diff --git a/Source/Core/VideoBackends/OGL/Src/RasterFont.cpp b/Source/Core/VideoBackends/OGL/Src/RasterFont.cpp
index c1817f3eeb..42b8963784 100644
--- a/Source/Core/VideoBackends/OGL/Src/RasterFont.cpp
+++ b/Source/Core/VideoBackends/OGL/Src/RasterFont.cpp
@@ -144,7 +144,7 @@ RasterFont::RasterFont()
 	for(u32 y=0; y<char_height; y++) {
 		for(u32 c=0; c<char_count; c++) {
 			for(u32 x=0; x<char_width; x++) {
-				bool pixel = rasters[c][y] & (1<<(char_width-x-1));
+				bool pixel = (0 != (rasters[c][y] & (1<<(char_width-x-1))));
 				texture_data[char_width*char_count*y+char_width*c+x] = pixel ? -1 : 0;
 			}
 		}
diff --git a/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp b/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp
index 6887a0bdd0..a02738479a 100644
--- a/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp
@@ -1460,7 +1460,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
 						for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
 						{
 							u32 *newdst = dst+(y+iy)*width+x;
-							const __m128i mask = _mm_set_epi8(128,128,6,7,128,128,4,5,128,128,2,3,128,128,0,1);
+							const __m128i mask = _mm_set_epi8(-128,-128,6,7,-128,-128,4,5,-128,-128,2,3,-128,-128,0,1);
 								const __m128i valV = _mm_shuffle_epi8(_mm_loadl_epi64((const __m128i*)(src + 8 * xStep)),mask);
 								int cmp = _mm_movemask_epi8(valV); //MSB: 0x2 = val0; 0x20=val1; 0x200 = val2; 0x2000=val3
 								if ((cmp&0x2222)==0x2222) // SSSE3 case #1: all 4 pixels are in RGB555 and alpha = 0xFF.