Fixes spacing for "for", "while", "switch" and "if"

Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
This commit is contained in:
Matthew Parlane
2014-03-11 00:35:07 +13:00
parent 4591464486
commit 31cfc73a09
189 changed files with 1250 additions and 1159 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
float fc1; // Cutoff frequencies
// Sanity check
if(*n==0) return nullptr;
if (*n==0) return nullptr;
MathUtil::Clamp(&fc[0],float(0.001),float(1));
float *w=(float*)calloc(sizeof(float),*n);
+3 -3
View File
@@ -48,8 +48,8 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_
float numLeft = ((indexW - indexR) & INDEX_MASK) / 2;
m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG;
float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR;
if(offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
if(offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT;
if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT;
//render numleft sample pairs to samples[]
//advance indexR with sample position
@@ -65,7 +65,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_
static u32 frac = 0;
const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate );
if(ratio > 0x10000)
if (ratio > 0x10000)
ERROR_LOG(AUDIO, "ratio out of range");
for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) {
+1 -1
View File
@@ -105,7 +105,7 @@ void OpenALStream::Clear(bool mute)
{
m_muted = mute;
if(m_muted)
if (m_muted)
{
soundTouch.clear();
alSourceStop(uiSource);
+1 -1
View File
@@ -49,7 +49,7 @@ void PulseAudio::SoundLoop()
while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0)
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr);
if(m_pa_error < 0)
if (m_pa_error < 0)
ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error));
PulseShutdown();
+3 -3
View File
@@ -193,9 +193,9 @@ void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
void ARMXEmitter::FlushLitPool()
{
for(LiteralPool& pool : currentLitPool) {
for (LiteralPool& pool : currentLitPool) {
// Search for duplicates
for(LiteralPool& old_pool : currentLitPool) {
for (LiteralPool& old_pool : currentLitPool) {
if (old_pool.val == pool.val)
pool.loc = old_pool.loc;
}
@@ -242,7 +242,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
{
// Use MOVW+MOVT for ARMv7+
MOVW(reg, val & 0xFFFF);
if(val & 0xFFFF0000)
if (val & 0xFFFF0000)
MOVT(reg, val, true);
} else if (!TrySetValue_TwoOp(reg,val)) {
// Use literal pool for ARMv6.
+2 -2
View File
@@ -161,7 +161,7 @@ public:
Operand2(ARMReg base, ShiftType type, u8 shift)// For IMM shifted register
{
if(shift == 32) shift = 0;
if (shift == 32) shift = 0;
switch (type)
{
case ST_LSL:
@@ -198,7 +198,7 @@ public:
}
u32 GetData()
{
switch(Type)
switch (Type)
{
case TYPE_IMM:
return Imm12Mod(); // This'll need to be changed later
+9 -9
View File
@@ -73,11 +73,11 @@ std::vector<std::string> cdio_get_devices()
std::vector<std::string> drives;
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
if( kern_result != KERN_SUCCESS )
if (kern_result != KERN_SUCCESS)
return( drives );
classes_to_match = IOServiceMatching( kIOCDMediaClass );
if( classes_to_match == nullptr )
if (classes_to_match == nullptr)
return( drives );
CFDictionarySetValue( classes_to_match,
@@ -85,11 +85,11 @@ std::vector<std::string> cdio_get_devices()
kern_result = IOServiceGetMatchingServices( master_port,
classes_to_match, &media_iterator );
if( kern_result != KERN_SUCCESS)
if (kern_result != KERN_SUCCESS)
return( drives );
next_media = IOIteratorNext( media_iterator );
if( next_media != 0 )
if (next_media != 0)
{
char psz_buf[0x32];
size_t dev_path_length;
@@ -101,7 +101,7 @@ std::vector<std::string> cdio_get_devices()
IORegistryEntryCreateCFProperty( next_media,
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault,
0 );
if( str_bsd_path == nullptr )
if (str_bsd_path == nullptr)
{
IOObjectRelease( next_media );
continue;
@@ -113,12 +113,12 @@ std::vector<std::string> cdio_get_devices()
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
dev_path_length = strlen( psz_buf );
if( CFStringGetCString( (CFStringRef)str_bsd_path,
if (CFStringGetCString( (CFStringRef)str_bsd_path,
(char*)&psz_buf + dev_path_length,
sizeof(psz_buf) - dev_path_length,
kCFStringEncodingASCII))
{
if(psz_buf != nullptr)
if (psz_buf != nullptr)
{
std::string str = psz_buf;
drives.push_back(str);
@@ -127,7 +127,7 @@ std::vector<std::string> cdio_get_devices()
CFRelease( str_bsd_path );
IOObjectRelease( next_media );
} while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 );
} while (( next_media = IOIteratorNext( media_iterator ) ) != 0);
}
IOObjectRelease( media_iterator );
return drives;
@@ -175,7 +175,7 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
bool is_cd=false;
// If it does exist, verify that it is a cdrom/dvd drive
int cdfd = open(drive.c_str(), (O_RDONLY|O_NONBLOCK), 0);
if ( cdfd >= 0 )
if (cdfd >= 0)
{
#ifdef __linux__
if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1)
+1 -1
View File
@@ -306,7 +306,7 @@ private:
void DoVoid(void *data, u32 size)
{
for(u32 i = 0; i != size; ++i)
for (u32 i = 0; i != size; ++i)
DoByte(reinterpret_cast<u8*>(data)[i]);
}
};
+5 -5
View File
@@ -35,8 +35,8 @@ struct ArraySizeImpl : public std::extent<T>
#define __GNUC_PREREQ(a, b) 0
#endif
#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) \
&& !defined __SSSE3__ && !defined _M_GENERIC
#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) && \
!defined __SSSE3__ && !defined _M_GENERIC
#include <emmintrin.h>
static __inline __m128i __attribute__((__always_inline__))
_mm_shuffle_epi8(__m128i a, __m128i mask)
@@ -122,18 +122,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){
// Retrieve the current thread-specific locale
locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
if(new_locale == LC_GLOBAL_LOCALE)
if (new_locale == LC_GLOBAL_LOCALE)
{
// Restore the global locale
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
}
else if(new_locale != nullptr)
else if (new_locale != nullptr)
{
// Configure the thread to set the locale only for this thread
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
// Set all locale categories
for(int i = LC_MIN; i <= LC_MAX; i++)
for (int i = LC_MIN; i <= LC_MAX; i++)
setlocale(i, new_locale->locinfo->lc_category[i].locale);
}
+1 -1
View File
@@ -318,7 +318,7 @@ static void silly_random(u8 * rndArea, u8 count)
u16 i;
srand((unsigned) (time(nullptr)));
for(i=0;i<count;i++)
for (i=0;i<count;i++)
{
rndArea[i]=rand();
}
+11 -11
View File
@@ -34,7 +34,7 @@ void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut )
ULONG index = 0;
PCSTR lpAct = lpszIn;
for( ; ; lpAct++ )
for ( ; ; lpAct++ )
{
lpszOut[index++] = (TCHAR)(*lpAct);
if ( *lpAct == 0 )
@@ -196,7 +196,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == nullptr && _tcsstr( lpszUnDSymbol, _T("()") ) == nullptr)
{
ULONG index = 0;
for( ; ; index++ )
for ( ; ; index++ )
{
lpszParamSep = _tcschr( lpszParsed, _T(',') );
if ( lpszParamSep == nullptr )
@@ -331,7 +331,7 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
PrintFunctionAndSourceInfo(file, callStack);
for( ULONG index = 0; ; index++ )
for ( ULONG index = 0; ; index++ )
{
bResult = StackWalk(
IMAGE_FILE_MACHINE_I386,
@@ -347,14 +347,14 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
if ( index == 0 )
continue;
if( !bResult || callStack.AddrFrame.Offset == 0 )
if (!bResult || callStack.AddrFrame.Offset == 0)
break;
PrintFunctionAndSourceInfo(file, callStack);
}
if ( hThread != GetCurrentThread() )
if (hThread != GetCurrentThread())
ResumeThread( hThread );
}
@@ -366,7 +366,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
// If it's not this thread, let's suspend it, and resume it at the end
if ( hThread != GetCurrentThread() )
if ( SuspendThread( hThread ) == -1 )
if (SuspendThread( hThread ) == -1)
{
// whaaat ?!
etfprint(file, "Call stack info failed\n");
@@ -386,7 +386,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
PrintFunctionAndSourceInfo(file, callStack);
for( ULONG index = 0; ; index++ )
for (ULONG index = 0; ; index++)
{
bResult = StackWalk(
IMAGE_FILE_MACHINE_I386,
@@ -399,17 +399,17 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
SymGetModuleBase,
nullptr);
if ( index == 0 )
if (index == 0)
continue;
if( !bResult || callStack.AddrFrame.Offset == 0 )
if (!bResult || callStack.AddrFrame.Offset == 0)
break;
PrintFunctionAndSourceInfo(file, callStack);
}
if ( hThread != GetCurrentThread() )
ResumeThread( hThread );
if (hThread != GetCurrentThread())
ResumeThread(hThread);
}
char g_uefbuf[2048];
+3 -3
View File
@@ -78,9 +78,9 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
{
std::string found(dp->d_name);
if ((found != ".") && (found != "..")
&& (found.size() >= end_match.size())
&& std::equal(end_match.rbegin(), end_match.rend(), found.rbegin()))
if ((found != ".") && (found != "..") &&
(found.size() >= end_match.size()) &&
std::equal(end_match.rbegin(), end_match.rend(), found.rbegin()))
{
std::string full_name;
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
+22 -22
View File
@@ -155,9 +155,9 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
const u8 * data = (const u8*)src;
const int nblocks = len / 16;
u32 Step = (len / 8);
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
if (Step < 1) Step = 1;
u64 h1 = 0x9368e53c2f6af274;
u64 h2 = 0x586dcd208f7cd3fd;
@@ -171,7 +171,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
const u64 * blocks = (const u64 *)(data);
for(int i = 0; i < nblocks; i+=Step)
for (int i = 0; i < nblocks; i+=Step)
{
u64 k1 = getblock(blocks,i*2+0);
u64 k2 = getblock(blocks,i*2+1);
@@ -187,7 +187,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
u64 k1 = 0;
u64 k2 = 0;
switch(len & 15)
switch (len & 15)
{
case 15: k2 ^= u64(tail[14]) << 48;
case 14: k2 ^= u64(tail[13]) << 40;
@@ -233,10 +233,10 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
if (Step < 1) Step = 1;
while (data < end)
{
h = _mm_crc32_u64(h, data[0]);
data += Step;
@@ -265,10 +265,10 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
if (Step < 1) Step = 1;
while (data < end)
{
u64 k = data[0];
data+=Step;
@@ -281,7 +281,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
const u8 * data2 = (const u8*)end;
switch(len & 7)
switch (len & 7)
{
case 7: h ^= u64(data2[6]) << 48;
case 6: h ^= u64(data2[5]) << 40;
@@ -308,10 +308,10 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
u32 Step = (len/4);
const u32 *data = (const u32 *)src;
const u32 *end = data + Step;
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
if (Step < 1) Step = 1;
while (data < end)
{
h = _mm_crc32_u32(h, data[0]);
data += Step;
@@ -380,9 +380,9 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
u32 out[2];
const int nblocks = len / 8;
u32 Step = (len / 4);
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
if (Step < 1) Step = 1;
u32 h1 = 0x8de1c3ac;
u32 h2 = 0xbab98226;
@@ -395,7 +395,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
const u32 * blocks = (const u32 *)(data + nblocks*8);
for(int i = -nblocks; i < 0; i+=Step)
for (int i = -nblocks; i < 0; i+=Step)
{
u32 k1 = getblock(blocks,i*2+0);
u32 k2 = getblock(blocks,i*2+1);
@@ -411,7 +411,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
u32 k1 = 0;
u32 k2 = 0;
switch(len & 7)
switch (len & 7)
{
case 7: k2 ^= tail[6] << 16;
case 6: k2 ^= tail[5] << 8;
@@ -456,10 +456,10 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
if(samples == 0) samples = max(Step, 1u);
if (samples == 0) samples = max(Step, 1u);
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
if (Step < 1) Step = 1;
while (data < end)
{
u64 k = data[0];
data+=Step;
@@ -472,7 +472,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
const u8 * data2 = (const u8*)end;
switch(len & 7)
switch (len & 7)
{
case 7: h ^= u64(data2[6]) << 48;
case 6: h ^= u64(data2[5]) << 40;
+5 -2
View File
@@ -373,8 +373,11 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data)
// Lines starting with '$', '*' or '+' are kept verbatim.
// Kind of a hack, but the support for raw lines inside an
// INI is a hack anyway.
if ((key == "" && value == "")
|| (line.size() >= 1 && (line[0] == '$' || line[0] == '+' || line[0] == '*')))
if ((key == "" && value == "") ||
(line.size() >= 1 &&
(line[0] == '$' ||
line[0] == '+' ||
line[0] == '*')))
current_section->lines.push_back(line);
else
current_section->Set(key, value);
+2 -2
View File
@@ -150,8 +150,8 @@ private:
{
char file_header[sizeof(Header)];
return (Read(file_header, sizeof(Header))
&& !memcmp((const char*)&m_header, file_header, sizeof(Header)));
return (Read(file_header, sizeof(Header)) &&
!memcmp((const char*)&m_header, file_header, sizeof(Header)));
}
template <typename D>
+1 -1
View File
@@ -195,7 +195,7 @@ void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33)
void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16])
{
for(int i = 0; i < 16; ++i)
for (int i = 0; i < 16; ++i)
{
mtx.data[i] = mtxArray[i];
}
+1 -1
View File
@@ -56,7 +56,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
crit_caption = str_translator(_trans("Critical"));
}
switch(Style)
switch (Style)
{
case INFORMATION:
caption = info_caption;
+2 -2
View File
@@ -84,13 +84,13 @@ void SettingsHandler::Reset()
void SettingsHandler::AddSetting(const std::string& key, const std::string& value)
{
for(const char& c : key) {
for (const char& c : key) {
WriteByte(c);
}
WriteByte('=');
for(const char& c : value) {
for (const char& c : value) {
WriteByte(c);
}
+5 -5
View File
@@ -173,8 +173,8 @@ bool TryParse(const std::string &str, u32 *const output)
return false;
#if ULONG_MAX > UINT_MAX
if (value >= 0x100000000ull
&& value <= 0xFFFFFFFF00000000ull)
if (value >= 0x100000000ull &&
value <= 0xFFFFFFFF00000000ull)
return false;
#endif
@@ -275,7 +275,7 @@ std::string TabsToSpaces(int tab_size, const std::string &in)
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
{
while(1)
while (1)
{
size_t pos = result.find(src);
if (pos == std::string::npos) break;
@@ -336,8 +336,8 @@ std::string UriDecode(const std::string & sSrc)
if (*pSrc == '%')
{
char dec1, dec2;
if (16 != (dec1 = HEX2DEC[*(pSrc + 1)])
&& 16 != (dec2 = HEX2DEC[*(pSrc + 2)]))
if (16 != (dec1 = HEX2DEC[*(pSrc + 1)]) &&
16 != (dec2 = HEX2DEC[*(pSrc + 2)]))
{
*pEnd++ = (dec1 << 4) + dec2;
pSrc += 3;
+1 -1
View File
@@ -153,7 +153,7 @@ u64 Timer::GetLocalTimeSinceJan1970()
// Account for DST where needed
gmTime = localtime(&sysTime);
if(gmTime->tm_isdst == 1)
if (gmTime->tm_isdst == 1)
tzDST = 3600;
else
tzDST = 0;

Some files were not shown because too many files have changed in this diff Show More