summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authormagumagu <magumagu9@gmail.com>2015-02-10 11:39:14 -0800
committermagumagu <magumagu9@gmail.com>2015-02-10 11:39:14 -0800
commit0f96a0104e60045e39d0c2a2ff34ec06bb8c3634 (patch)
tree163ce59f9b1d45fcb5b563010408c4ca35c399f6 /Source/Core
parent1acd80f23f09d14e921503b020e678f89544a6c3 (diff)
parent4f324ad74280540efc7fdc66a30d43594118938d (diff)
Merge pull request #1752 from Buddybenj/clean-up
Clean Up
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Mixer.cpp10
-rw-r--r--Source/Core/Core/DSPEmulator.cpp4
-rw-r--r--Source/Core/Core/HW/CPU.cpp3
-rw-r--r--Source/Core/Core/MemTools.cpp2
-rw-r--r--Source/Core/Core/NetPlayProto.h2
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.cpp2
-rw-r--r--Source/Core/Core/State.cpp3
-rw-r--r--Source/Core/DiscIO/WbfsBlob.cpp23
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp2
-rw-r--r--Source/Core/DolphinWX/AboutDolphin.cpp2
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp2
-rw-r--r--Source/Core/VideoBackends/D3D/Television.cpp2
12 files changed, 21 insertions, 36 deletions
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp
index 60203b2f37..90f771d3fa 100644
--- a/Source/Core/AudioCommon/Mixer.cpp
+++ b/Source/Core/AudioCommon/Mixer.cpp
@@ -51,27 +51,27 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
aid_sample_rate = aid_sample_rate * (framelimit - 1) * 5 / VideoInterface::TargetRefreshRate;
}
- const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_mixer->m_sampleRate );
+ const u32 ratio = (u32)(65536.0f * aid_sample_rate / (float)m_mixer->m_sampleRate);
s32 lvolume = m_LVolume;
s32 rvolume = m_RVolume;
// TODO: consider a higher-quality resampling algorithm.
- for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2)
+ for (; currentSample < numSamples * 2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample += 2)
{
u32 indexR2 = indexR + 2; //next sample
s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current
s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); //next
- int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
+ int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
sampleL = (sampleL * lvolume) >> 8;
sampleL += samples[currentSample + 1];
MathUtil::Clamp(&sampleL, -32767, 32767);
- samples[currentSample+1] = sampleL;
+ samples[currentSample + 1] = sampleL;
s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current
s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next
- int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
+ int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
sampleR = (sampleR * rvolume) >> 8;
sampleR += samples[currentSample];
MathUtil::Clamp(&sampleR, -32767, 32767);
diff --git a/Source/Core/Core/DSPEmulator.cpp b/Source/Core/Core/DSPEmulator.cpp
index a15f5be6e6..61f6e8e348 100644
--- a/Source/Core/Core/DSPEmulator.cpp
+++ b/Source/Core/Core/DSPEmulator.cpp
@@ -10,11 +10,7 @@
DSPEmulator *CreateDSPEmulator(bool HLE)
{
if (HLE)
- {
return new DSPHLE();
- }
else
- {
return new DSPLLE();
- }
}
diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp
index 6164817194..2c810d8a15 100644
--- a/Source/Core/Core/HW/CPU.cpp
+++ b/Source/Core/Core/HW/CPU.cpp
@@ -42,7 +42,6 @@ void CCPU::Run()
while (true)
{
-reswitch:
switch (PowerPC::GetState())
{
case PowerPC::CPU_RUNNING:
@@ -60,7 +59,7 @@ reswitch:
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
return;
if (PowerPC::GetState() != PowerPC::CPU_STEPPING)
- goto reswitch;
+ continue;
//3: do a step
PowerPC::SingleStep();
diff --git a/Source/Core/Core/MemTools.cpp b/Source/Core/Core/MemTools.cpp
index 13029f245d..4c20ca2877 100644
--- a/Source/Core/Core/MemTools.cpp
+++ b/Source/Core/Core/MemTools.cpp
@@ -136,7 +136,7 @@ static void ExceptionThread(mach_port_t port)
mach_msg_header_t *send_msg = nullptr;
mach_msg_size_t send_size = 0;
mach_msg_option_t option = MACH_RCV_MSG;
- while (1)
+ while (true)
{
// If this isn't the first run, send the reply message. Then, receive
// a message: either a mach_exception_raise_state RPC due to
diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h
index 01b4964350..255635810b 100644
--- a/Source/Core/Core/NetPlayProto.h
+++ b/Source/Core/Core/NetPlayProto.h
@@ -32,7 +32,7 @@ typedef std::vector<u8> NetWiimote;
#define NETPLAY_VERSION "Dolphin NetPlay 2014-01-08"
-const int NETPLAY_INITIAL_GCTIME = 1272737767;
+static const int NETPLAY_INITIAL_GCTIME = 1272737767;
// messages
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 17c8c7f98e..2cd692572d 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -313,7 +313,7 @@ static void FindFunctionsAfterBLR(PPCSymbolDB *func_db)
{
while (true)
{
- // skip zeroes that sometimes pad function to 16 byte boundary (eg. Donkey Kong Country Returns)
+ // skip zeroes that sometimes pad function to 16 byte boundary (e.g. Donkey Kong Country Returns)
while (Memory::Read_Instruction(location) == 0 && ((location & 0xf) != 0))
location += 4;
if (PPCTables::IsValidInstruction(Memory::Read_Instruction(location)))
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index 2b3ce95e08..23dad1e098 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -176,7 +176,8 @@ static int GetEmptySlot(std::map<double, int> m)
break;
}
}
- if (!found) return i;
+ if (!found)
+ return i;
}
return -1;
}
diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp
index 08cb4ec078..7f0a625968 100644
--- a/Source/Core/DiscIO/WbfsBlob.cpp
+++ b/Source/Core/DiscIO/WbfsBlob.cpp
@@ -40,10 +40,8 @@ WbfsFileReader::WbfsFileReader(const std::string& filename)
WbfsFileReader::~WbfsFileReader()
{
- for (u32 i = 0; i != m_files.size(); ++ i)
- {
- delete m_files[i];
- }
+ for (file_entry* entry : m_files)
+ delete entry;
delete[] m_wlba_table;
}
@@ -58,7 +56,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
// Replace last character with index (e.g. wbfs = wbf1)
std::string path = filename;
- if (0 != m_total_files)
+ if (m_total_files != 0)
{
path[path.length() - 1] = '0' + m_total_files;
}
@@ -73,7 +71,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
new_entry->size = new_entry->file.GetSize();
m_size += new_entry->size;
- m_total_files ++;
+ m_total_files++;
m_files.push_back(new_entry);
}
}
@@ -90,10 +88,7 @@ bool WbfsFileReader::ReadHeader()
m_hd_sector_size = 1ull << m_hd_sector_shift;
if (m_size != (m_hd_sector_count * m_hd_sector_size))
- {
- //printf("File size doesn't match expected size\n");
return false;
- }
// Read wbfs cluster info
m_files[0]->file.ReadBytes(&m_wbfs_sector_shift, 1);
@@ -101,10 +96,7 @@ bool WbfsFileReader::ReadHeader()
m_wbfs_sector_count = m_size / m_wbfs_sector_size;
if (m_wbfs_sector_size < WII_SECTOR_SIZE)
- {
- //Setting this too low would case a very large memory allocation
return false;
- }
m_blocks_per_disc = (WII_SECTOR_COUNT * WII_SECTOR_SIZE) / m_wbfs_sector_size;
m_disc_info_size = align(WII_DISC_HEADER_SIZE + m_blocks_per_disc * 2, m_hd_sector_size);
@@ -113,11 +105,8 @@ bool WbfsFileReader::ReadHeader()
m_files[0]->file.Seek(2, SEEK_CUR);
m_files[0]->file.ReadBytes(m_disc_table, 500);
- if (0 == m_disc_table[0])
- {
- //printf("Game must be in 'slot 0'\n");
+ if (m_disc_table[0] == 0)
return false;
- }
return true;
}
@@ -153,7 +142,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
u64 cluster_offset = offset & (m_wbfs_sector_size - 1);
u64 final_address = cluster_address + cluster_offset;
- for (u32 i = 0; i != m_total_files; i ++)
+ for (u32 i = 0; i != m_total_files; i++)
{
if (final_address < (m_files[i]->base_address + m_files[i]->size))
{
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 75d7729eaa..90fa48abb1 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -284,7 +284,7 @@ void DMainWindow::OnOpenDocs()
void DMainWindow::OnOpenGitHub()
{
- QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin/")));
+ QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin")));
}
void DMainWindow::OnOpenSystemInfo()
diff --git a/Source/Core/DolphinWX/AboutDolphin.cpp b/Source/Core/DolphinWX/AboutDolphin.cpp
index 19c6742bae..4ab29b068e 100644
--- a/Source/Core/DolphinWX/AboutDolphin.cpp
+++ b/Source/Core/DolphinWX/AboutDolphin.cpp
@@ -41,7 +41,7 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
"Today Dolphin is an open source project with many\n"
"contributors, too many to list.\n"
"If interested, just go check out the project page at\n"
- "https://github.com/dolphin-emu/dolphin/ .\n"
+ "https://github.com/dolphin-emu/dolphin .\n"
"\n"
"Special thanks to Bushing, Costis, CrowTRobo,\n"
"Marcan, Segher, Titanik, or9 and Hotquik for their\n"
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index a430ce051f..698b020f71 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1415,7 +1415,7 @@ void CFrame::OnHelp(wxCommandEvent& event)
WxUtils::Launch("https://dolphin-emu.org/docs/guides/");
break;
case IDM_HELP_GITHUB:
- WxUtils::Launch("https://github.com/dolphin-emu/dolphin/");
+ WxUtils::Launch("https://github.com/dolphin-emu/dolphin");
break;
}
}
diff --git a/Source/Core/VideoBackends/D3D/Television.cpp b/Source/Core/VideoBackends/D3D/Television.cpp
index 1c7fa55a56..2ebcd64b99 100644
--- a/Source/Core/VideoBackends/D3D/Television.cpp
+++ b/Source/Core/VideoBackends/D3D/Television.cpp
@@ -136,7 +136,7 @@ void Television::Submit(u32 xfbAddr, u32 stride, u32 width, u32 height)
// Load data from GameCube RAM to YUYV texture
u8* yuyvSrc = Memory::GetPointer(xfbAddr);
D3D11_BOX box = CD3D11_BOX(0, 0, 0, stride, height, 1);
- D3D::context->UpdateSubresource(m_yuyvTexture, 0, &box, yuyvSrc, 2*stride, 2*stride*height);
+ D3D::context->UpdateSubresource(m_yuyvTexture, 0, &box, yuyvSrc, 2 * stride, 2 * stride * height);
}
void Television::Render()