Formatting/Whitespace Cleanup

Various fixes to formatting and whitespace
This commit is contained in:
Stevoisiak 2015-02-15 14:43:31 -05:00
parent b8edd8aedc
commit 93b16a4a2d
97 changed files with 673 additions and 657 deletions

View File

@ -132,7 +132,8 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
float fc1; // Cutoff frequencies float fc1; // Cutoff frequencies
// Sanity check // Sanity check
if (*n==0) return nullptr; if (*n == 0)
return nullptr;
MathUtil::Clamp(&fc[0], float(0.001), float(1)); MathUtil::Clamp(&fc[0], float(0.001), float(1));
float *w = (float*)calloc(sizeof(float), *n); float *w = (float*)calloc(sizeof(float), *n);

View File

@ -130,7 +130,7 @@ public:
BitField() = default; BitField() = default;
#ifndef _WIN32 #ifndef _WIN32
// We explicitly delete the copy assigment operator here, because the // We explicitly delete the copy assignment operator here, because the
// default copy assignment would copy the full storage value, rather than // default copy assignment would copy the full storage value, rather than
// just the bits relevant to this particular bit field. // just the bits relevant to this particular bit field.
// Ideally, we would just implement the copy assignment to copy only the // Ideally, we would just implement the copy assignment to copy only the

View File

@ -74,11 +74,11 @@ std::vector<std::string> cdio_get_devices()
kern_result = IOMasterPort(MACH_PORT_NULL, &master_port); kern_result = IOMasterPort(MACH_PORT_NULL, &master_port);
if (kern_result != KERN_SUCCESS) if (kern_result != KERN_SUCCESS)
return( drives ); return drives;
classes_to_match = IOServiceMatching(kIOCDMediaClass); classes_to_match = IOServiceMatching(kIOCDMediaClass);
if (classes_to_match == nullptr) if (classes_to_match == nullptr)
return( drives ); return drives;
CFDictionarySetValue(classes_to_match, CFDictionarySetValue(classes_to_match,
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue); CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
@ -86,7 +86,7 @@ std::vector<std::string> cdio_get_devices()
kern_result = IOServiceGetMatchingServices(master_port, kern_result = IOServiceGetMatchingServices(master_port,
classes_to_match, &media_iterator); classes_to_match, &media_iterator);
if (kern_result != KERN_SUCCESS) if (kern_result != KERN_SUCCESS)
return( drives ); return drives;
next_media = IOIteratorNext(media_iterator); next_media = IOIteratorNext(media_iterator);
if (next_media != 0) if (next_media != 0)
@ -122,7 +122,6 @@ std::vector<std::string> cdio_get_devices()
} }
CFRelease(str_bsd_path); CFRelease(str_bsd_path);
IOObjectRelease(next_media); IOObjectRelease(next_media);
} while ((next_media = IOIteratorNext(media_iterator)) != 0); } while ((next_media = IOIteratorNext(media_iterator)) != 0);
} }
IOObjectRelease(media_iterator); IOObjectRelease(media_iterator);
@ -166,7 +165,7 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
{ {
// Check if the device exists // Check if the device exists
if (!is_device(drive)) if (!is_device(drive))
return(false); return false;
bool is_cd = false; bool is_cd = false;
// If it does exist, verify that it is a cdrom/dvd drive // If it does exist, verify that it is a cdrom/dvd drive
@ -179,7 +178,7 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
is_cd = true; is_cd = true;
close(cdfd); close(cdfd);
} }
return(is_cd); return is_cd;
} }
// Returns a pointer to an array of strings with the device names // Returns a pointer to an array of strings with the device names

View File

@ -260,8 +260,7 @@ public:
LinkedListItem<T>* next = list_cur->next; LinkedListItem<T>* next = list_cur->next;
TFree(list_cur); TFree(list_cur);
list_cur = next; list_cur = next;
} } while (list_cur);
while (list_cur);
} }
} }
break; break;

View File

@ -24,11 +24,11 @@ u32 HashFletcher(const u8* data_u8, size_t length)
size_t tlen = len > 360 ? 360 : len; size_t tlen = len > 360 ? 360 : len;
len -= tlen; len -= tlen;
do { do
{
sum1 += *data++; sum1 += *data++;
sum2 += sum1; sum2 += sum1;
} } while (--tlen);
while (--tlen);
sum1 = (sum1 & 0xffff) + (sum1 >> 16); sum1 = (sum1 & 0xffff) + (sum1 >> 16);
sum2 = (sum2 & 0xffff) + (sum2 >> 16); sum2 = (sum2 & 0xffff) + (sum2 >> 16);
@ -58,8 +58,7 @@ u32 HashAdler32(const u8* data, size_t len)
{ {
a += *data++; a += *data++;
b += a; b += a;
} } while (--tlen);
while (--tlen);
a = (a & 0xffff) + (a >> 16) * (65536 - MOD_ADLER); a = (a & 0xffff) + (a >> 16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >> 16) * (65536 - MOD_ADLER); b = (b & 0xffff) + (b >> 16) * (65536 - MOD_ADLER);
@ -154,9 +153,11 @@ u64 GetMurmurHash3(const u8 *src, u32 len, u32 samples)
const u8 * data = (const u8*)src; const u8 * data = (const u8*)src;
const int nblocks = len / 16; const int nblocks = len / 16;
u32 Step = (len / 8); u32 Step = (len / 8);
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
u64 h1 = 0x9368e53c2f6af274; u64 h1 = 0x9368e53c2f6af274;
u64 h2 = 0x586dcd208f7cd3fd; u64 h2 = 0x586dcd208f7cd3fd;
@ -232,9 +233,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end - Step * 3) while (data < end - Step * 3)
{ {
h[0] = _mm_crc32_u64(h[0], data[Step * 0]); h[0] = _mm_crc32_u64(h[0], data[Step * 0]);
@ -280,9 +283,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
u64 k = data[0]; u64 k = data[0];
@ -323,9 +328,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
u32 Step = (len/4); u32 Step = (len/4);
const u32 *data = (const u32 *)src; const u32 *data = (const u32 *)src;
const u32 *end = data + Step; const u32 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
h = _mm_crc32_u32(h, data[0]); h = _mm_crc32_u32(h, data[0]);
@ -395,9 +402,11 @@ u64 GetMurmurHash3(const u8* src, u32 len, u32 samples)
u32 out[2]; u32 out[2];
const int nblocks = len / 8; const int nblocks = len / 8;
u32 Step = (len / 4); u32 Step = (len / 4);
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
u32 h1 = 0x8de1c3ac; u32 h1 = 0x8de1c3ac;
u32 h2 = 0xbab98226; u32 h2 = 0xbab98226;
@ -471,9 +480,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
u32 Step = (len / 8); u32 Step = (len / 8);
const u64 *data = (const u64 *)src; const u64 *data = (const u64 *)src;
const u64 *end = data + Step; const u64 *end = data + Step;
if (samples == 0) samples = std::max(Step, 1u); if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples; Step = Step / samples;
if (Step < 1) Step = 1; if (Step < 1)
Step = 1;
while (data < end) while (data < end)
{ {
u64 k = data[0]; u64 k = data[0];

View File

@ -63,7 +63,6 @@ public:
void Set(const std::string& key, bool newValue) void Set(const std::string& key, bool newValue)
{ {
Set(key, StringFromBool(newValue)); Set(key, StringFromBool(newValue));
} }
template<typename T> template<typename T>

View File

@ -41,7 +41,8 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title
// Open the console window and create the window handle for GetStdHandle() // Open the console window and create the window handle for GetStdHandle()
AllocConsole(); AllocConsole();
// Hide // Hide
if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE); if (Hidden)
ShowWindow(GetConsoleWindow(), SW_HIDE);
// Save the window handle that AllocConsole() created // Save the window handle that AllocConsole() created
hConsole = GetStdHandle(STD_OUTPUT_HANDLE); hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title // Set the console window title
@ -157,7 +158,8 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
{ {
#ifdef _WIN32 #ifdef _WIN32
// Check size // Check size
if (Width < 8 || Height < 12) return; if (Width < 8 || Height < 12)
return;
bool DBef = true; bool DBef = true;
bool DAft = true; bool DAft = true;
@ -233,10 +235,12 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
COORD Coo = GetCoordinates(OldCursor, LBufWidth); COORD Coo = GetCoordinates(OldCursor, LBufWidth);
SetConsoleCursorPosition(hConsole, Coo); SetConsoleCursorPosition(hConsole, Coo);
if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str()); if (SLog.length() > 0)
Log(LogTypes::LNOTICE, SLog.c_str());
// Resize the window too // Resize the window too
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true); if (Resize)
MoveWindow(GetConsoleWindow(), Left, Top, (Width + 100), Height, true);
#endif #endif
} }
@ -328,7 +332,8 @@ void ConsoleListener::ClearScreen(bool Cursor)
GetConsoleScreenBufferInfo(hConsole, &csbi); GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
// Reset cursor // Reset cursor
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); if (Cursor)
SetConsoleCursorPosition(hConsole, coordScreen);
#endif #endif
} }

View File

@ -219,7 +219,8 @@ void CPUInfo::Detect()
logical_cpu_count /= cores_x_package; logical_cpu_count /= cores_x_package;
} }
} }
} else }
else
{ {
// Use AMD's new method. // Use AMD's new method.
num_cores = (cpu_id[2] & 0xFF) + 1; num_cores = (cpu_id[2] & 0xFF) + 1;

View File

@ -93,7 +93,6 @@ bool CCPU::IsStepping()
void CCPU::Reset() void CCPU::Reset()
{ {
} }
void CCPU::StepOpcode(Common::Event *event) void CCPU::StepOpcode(Common::Event *event)

View File

@ -123,7 +123,6 @@ void CEXIAgp::LoadFileToEEPROM(const std::string& filename)
m_eeprom_size = 0; m_eeprom_size = 0;
m_eeprom.clear(); m_eeprom.clear();
} }
} }
void CEXIAgp::SaveFileFromEEPROM(const std::string& filename) void CEXIAgp::SaveFileFromEEPROM(const std::string& filename)

View File

@ -136,7 +136,6 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder)
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb) void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
{ {
DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN; DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN;
auto strUniqueID = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID; auto strUniqueID = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID;

View File

@ -171,7 +171,6 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
{ {
Memory::Write_U32(WC24_ERR_FATAL, BufferOut); Memory::Write_U32(WC24_ERR_FATAL, BufferOut);
} }
} }
else if (config.CreationStage() == nwc24_config_t::NWC24_IDCS_GENERATED) else if (config.CreationStage() == nwc24_config_t::NWC24_IDCS_GENERATED)
{ {

View File

@ -26,7 +26,6 @@ mffsx: 80036650 (huh?)
static void FPSCRtoFPUSettings(UReg_FPSCR fp) static void FPSCRtoFPUSettings(UReg_FPSCR fp)
{ {
FPURoundMode::SetRoundMode(fp.RN); FPURoundMode::SetRoundMode(fp.RN);
if (fp.VE || fp.OE || fp.UE || fp.ZE || fp.XE) if (fp.VE || fp.OE || fp.UE || fp.ZE || fp.XE)

View File

@ -251,7 +251,6 @@ void DGameTracker::SelectLastBootedGame()
m_tree_widget->SelectGame(game); m_tree_widget->SelectGame(game);
break; break;
} }
} }
} }
} }

View File

@ -50,7 +50,6 @@ private:
{ {
wxRadioButton* rad_oldvalue; wxRadioButton* rad_oldvalue;
wxRadioButton* rad_uservalue; wxRadioButton* rad_uservalue;
} m_value_x_radiobtn; } m_value_x_radiobtn;
void UpdateCheatSearchResultsList(); void UpdateCheatSearchResultsList();

View File

@ -715,7 +715,8 @@ void CConfigMain::CreateGUIControls()
{ {
sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); sbGamecubeEXIDevSettings->Add(GCEXIDeviceText[i], wxGBPosition(i, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
sbGamecubeEXIDevSettings->Add(GCEXIDevice[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2) ? 1 : 2), wxALIGN_CENTER_VERTICAL); sbGamecubeEXIDevSettings->Add(GCEXIDevice[i], wxGBPosition(i, 1), wxGBSpan(1, (i < 2) ? 1 : 2), wxALIGN_CENTER_VERTICAL);
if (i < 2) sbGamecubeEXIDevSettings->Add(GCMemcardPath[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); if (i < 2)
sbGamecubeEXIDevSettings->Add(GCMemcardPath[i], wxGBPosition(i, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
if (NetPlay::IsNetPlayRunning()) if (NetPlay::IsNetPlayRunning())
GCEXIDevice[i]->Disable(); GCEXIDevice[i]->Disable();
} }
@ -1100,7 +1101,7 @@ void CConfigMain::ChooseSlotPath(bool isSlotA, TEXIDevices device_type)
if (!memorycard.IsValid()) if (!memorycard.IsValid())
{ {
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \ WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \
"is not a valid gamecube memory card file"), filename.c_str())); "is not a valid GameCube memory card file"), filename.c_str()));
return; return;
} }
} }

View File

@ -804,7 +804,6 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event) void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
{ {
int flags; int flags;
long item = HitTest(event.GetPosition(), flags); long item = HitTest(event.GetPosition(), flags);
wxMenu popupMenu; wxMenu popupMenu;

View File

@ -290,7 +290,6 @@ void PostProcessingConfigDiag::Event_Slider(wxCommandEvent &ev)
s32 value = option_data.m_integer_step_values[i] * current_step + option_data.m_integer_min_values[i]; s32 value = option_data.m_integer_step_values[i] * current_step + option_data.m_integer_min_values[i];
m_post_processor->SetOptioni(config->GetOption(), i, value); m_post_processor->SetOptioni(config->GetOption(), i, value);
string_value = std::to_string(value); string_value = std::to_string(value);
} }
else else
{ {

View File

@ -328,7 +328,6 @@ void Renderer::DrawDebugText()
if ((u32)OSDTime > Common::Timer::GetTimeMs()) if ((u32)OSDTime > Common::Timer::GetTimeMs())
{ {
const char* res_text = ""; const char* res_text = "";
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {

View File

@ -113,7 +113,6 @@ class ShaderCode : public ShaderGeneratorInterface
public: public:
ShaderCode() : buf(nullptr), write_ptr(nullptr) ShaderCode() : buf(nullptr), write_ptr(nullptr)
{ {
} }
void Write(const char* fmt, ...) void Write(const char* fmt, ...)

View File

@ -41,7 +41,6 @@ public:
return std::hash<u64>::operator()(id); return std::hash<u64>::operator()(id);
} }
}; };
}; };
struct TCacheEntryBase struct TCacheEntryBase
{ {

View File

@ -553,8 +553,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start; if (nTransformMatricesChanged[0] > start)
if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; nTransformMatricesChanged[0] = start;
if (nTransformMatricesChanged[1] < end)
nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END ? XFMEM_POSMATRICES_END : end;
} }
} }
@ -570,8 +573,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start; if (nNormalMatricesChanged[0] > _start)
if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end; nNormalMatricesChanged[0] = _start;
if (nNormalMatricesChanged[1] < _end)
nNormalMatricesChanged[1] = _end;
} }
} }
@ -587,8 +593,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start; if (nPostTransformMatricesChanged[0] > _start)
if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end; nPostTransformMatricesChanged[0] = _start;
if (nPostTransformMatricesChanged[1] < _end)
nPostTransformMatricesChanged[1] = _end;
} }
} }
@ -604,8 +613,11 @@ void VertexShaderManager::InvalidateXFRange(int start, int end)
} }
else else
{ {
if (nLightsChanged[0] > _start) nLightsChanged[0] = _start; if (nLightsChanged[0] > _start)
if (nLightsChanged[1] < _end) nLightsChanged[1] = _end; nLightsChanged[0] = _start;
if (nLightsChanged[1] < _end)
nLightsChanged[1] = _end;
} }
} }
} }