From f5d38649c7ad6fedf9db95044e3ad91ce393b8df Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 19 Nov 2014 08:49:13 +0000 Subject: Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated --- src/common/chunk_file.h | 14 +++++----- src/common/common_funcs.h | 14 +++++----- src/common/common_types.h | 2 +- src/common/console_listener.cpp | 24 ++++++++-------- src/common/extended_trace.cpp | 26 ++++++++--------- src/common/fifo_queue.h | 2 +- src/common/file_search.cpp | 2 +- src/common/file_util.cpp | 62 ++++++++++++++++++++--------------------- src/common/hash.cpp | 32 ++++++++++----------- src/common/linear_disk_cache.h | 6 ++-- src/common/log.h | 6 ++-- src/common/log_manager.cpp | 10 +++---- src/common/log_manager.h | 4 +-- src/common/math_util.cpp | 14 +++++----- src/common/mem_arena.cpp | 10 +++---- src/common/memory_util.cpp | 8 +++--- src/common/msg_handler.h | 42 ++++++++++++++-------------- src/common/string_util.cpp | 18 ++++++------ src/common/string_util.h | 2 +- src/common/symbols.cpp | 4 +-- src/common/thread.cpp | 6 ++-- src/common/thread.h | 8 +++--- src/common/thread_queue_list.h | 4 +-- 23 files changed, 160 insertions(+), 160 deletions(-) (limited to 'src/common') diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index dc8ac1fd..60978407 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -51,7 +51,7 @@ public: PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) { } ~PointerWrapSection(); - + bool operator == (const int &v) const { return ver_ == v; } bool operator != (const int &v) const { return ver_ != v; } bool operator <= (const int &v) const { return ver_ <= v; } @@ -196,7 +196,7 @@ public: } (*ptr) += size; } - + template void Do(std::map &x) { @@ -364,7 +364,7 @@ public: if (vec_size > 0) DoArray(&x[0], vec_size); } - + // Store deques. template void Do(std::deque &x) @@ -481,11 +481,11 @@ public: } // Store strings. - void Do(std::string &x) + void Do(std::string &x) { int stringLen = (int)x.length() + 1; Do(stringLen); - + switch (mode) { case MODE_READ: x = (char*)*ptr; break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; @@ -495,7 +495,7 @@ public: (*ptr) += stringLen; } - void Do(std::wstring &x) + void Do(std::wstring &x) { int stringLen = sizeof(wchar_t)*((int)x.length() + 1); Do(stringLen); @@ -534,7 +534,7 @@ public: void Do(T &x) { DoHelper::Do(this, x); } - + template void DoPOD(T &x) { DoHelper::Do(this, x); diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index c18afe11..d84ec4c4 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -17,7 +17,7 @@ template<> struct CompileTimeAssert {}; #define b2(x) ( (x) | ( (x) >> 1) ) #define b4(x) ( b2(x) | ( b2(x) >> 2) ) #define b8(x) ( b4(x) | ( b4(x) >> 4) ) -#define b16(x) ( b8(x) | ( b8(x) >> 8) ) +#define b16(x) ( b8(x) | ( b8(x) >> 8) ) #define b32(x) (b16(x) | (b16(x) >>16) ) #define ROUND_UP_POW2(x) (b32(x - 1) + 1) @@ -79,12 +79,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){ #define unlink _unlink #define snprintf _snprintf #define vscprintf _vscprintf - + // Locale Cross-Compatibility #define locale_t _locale_t #define freelocale _free_locale #define newlocale(mask, locale, base) _create_locale(mask, locale) - + #define LC_GLOBAL_LOCALE ((locale_t)-1) #define LC_ALL_MASK LC_ALL #define LC_COLLATE_MASK LC_COLLATE @@ -92,7 +92,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){ #define LC_MONETARY_MASK LC_MONETARY #define LC_NUMERIC_MASK LC_NUMERIC #define LC_TIME_MASK LC_TIME - + inline locale_t uselocale(locale_t new_locale) { // Retrieve the current per thread locale setting @@ -168,8 +168,8 @@ inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} #elif _M_ARM -inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} -inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} +inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} +inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);} #elif __linux__ inline u16 swap16(u16 _data) {return bswap_16(_data);} @@ -226,7 +226,7 @@ template inline T FromBigEndian(T data) { //static_assert(std::is_arithmetic::value, "function only makes sense with arithmetic types"); - + swap(reinterpret_cast(&data)); return data; } diff --git a/src/common/common_types.h b/src/common/common_types.h index 7ce6b224..6d432e46 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -22,7 +22,7 @@ * http://code.google.com/p/gekko-gc-emu/ */ -#pragma once +#pragma once #include #include diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp index 53f20d75..d7f27c35 100644 --- a/src/common/console_listener.cpp +++ b/src/common/console_listener.cpp @@ -86,7 +86,7 @@ bool ConsoleListener::IsOpen() /* LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are - dependent on each other, that's the reason for the additional checks. + dependent on each other, that's the reason for the additional checks. */ void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst) { @@ -225,7 +225,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool BytesWritten += cAttrWritten; coordScreen = GetCoordinates(BytesWritten, LBufWidth); - } + } const int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X; COORD Coo = GetCoordinates(OldCursor, LBufWidth); @@ -296,23 +296,23 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) } // Clear console screen void ConsoleListener::ClearScreen(bool Cursor) -{ +{ #if defined(_WIN32) - COORD coordScreen = { 0, 0 }; - DWORD cCharsWritten; - CONSOLE_SCREEN_BUFFER_INFO csbi; - DWORD dwConSize; + COORD coordScreen = { 0, 0 }; + DWORD cCharsWritten; + CONSOLE_SCREEN_BUFFER_INFO csbi; + DWORD dwConSize; - HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hConsole, &csbi); + GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; // Write space to the entire console - FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); - GetConsoleScreenBufferInfo(hConsole, &csbi); + FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); + GetConsoleScreenBufferInfo(hConsole, &csbi); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); // Reset cursor - if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); + if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); #endif } diff --git a/src/common/extended_trace.cpp b/src/common/extended_trace.cpp index 9cd0398e..bf61ac1d 100644 --- a/src/common/extended_trace.cpp +++ b/src/common/extended_trace.cpp @@ -29,7 +29,7 @@ using namespace std; void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) { #if defined(UNICODE)||defined(_UNICODE) - ULONG index = 0; + ULONG index = 0; PCSTR lpAct = lpszIn; for( ; ; lpAct++ ) @@ -37,7 +37,7 @@ void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) lpszOut[index++] = (TCHAR)(*lpAct); if ( *lpAct == 0 ) break; - } + } #else // This is trivial :) strcpy( lpszOut, lpszIn ); @@ -101,7 +101,7 @@ BOOL InitSymInfo( PCSTR lpszInitialSymbolPath ) CHAR lpszSymbolPath[BUFFERSIZE]; DWORD symOptions = SymGetOptions(); - symOptions |= SYMOPT_LOAD_LINES; + symOptions |= SYMOPT_LOAD_LINES; symOptions &= ~SYMOPT_UNDNAME; SymSetOptions( symOptions ); InitSymbolPath( lpszSymbolPath, lpszInitialSymbolPath ); @@ -153,15 +153,15 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L #ifndef _M_X64 DWORD dwDisp = 0; if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, &dwDisp, pSym ) ) -#else +#else //makes it compile but hell im not sure if this works... DWORD64 dwDisp = 0; if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, (PDWORD64)&dwDisp, pSym ) ) #endif { // Make the symbol readable for humans - UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE, - UNDNAME_COMPLETE | + UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE, + UNDNAME_COMPLETE | UNDNAME_NO_THISTYPE | UNDNAME_NO_SPECIAL_SYMS | UNDNAME_NO_MEMBER_TYPE | @@ -219,7 +219,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L _tcscat( lpszSymbol, lpszParsed ); ret = TRUE; - } + } GlobalFree( pSym ); return ret; @@ -325,14 +325,14 @@ 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, hProcess, hThread, &callStack, - NULL, + NULL, NULL, SymFunctionTableAccess, SymGetModuleBase, @@ -341,7 +341,7 @@ 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); @@ -382,14 +382,14 @@ 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, hProcess, hThread, &callStack, - NULL, + NULL, NULL, SymFunctionTableAccess, SymGetModuleBase, @@ -398,7 +398,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip, if ( index == 0 ) continue; - if( !bResult || callStack.AddrFrame.Offset == 0 ) + if( !bResult || callStack.AddrFrame.Offset == 0 ) break; PrintFunctionAndSourceInfo(file, callStack); diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h index 78a8f561..2c18285d 100644 --- a/src/common/fifo_queue.h +++ b/src/common/fifo_queue.h @@ -45,7 +45,7 @@ public: // create the element, add it to the queue m_write_ptr->current = new T(std::forward(t)); // set the next pointer to a new element ptr - // then advance the write pointer + // then advance the write pointer m_write_ptr = m_write_ptr->next = new ElementPtr(); Common::AtomicIncrement(m_size); } diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp index 63580f68..bfb54ce7 100644 --- a/src/common/file_search.cpp +++ b/src/common/file_search.cpp @@ -43,7 +43,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string& bool bkeepLooping = true; while (bkeepLooping) - { + { if (findData.cFileName[0] != '.') { std::string strFilename; diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 35da0730..b6dec838 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename) #endif if (result < 0) { - WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", + WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -102,7 +102,7 @@ bool Delete(const std::string &filename) { INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); - // Return true because we care about the file no + // Return true because we care about the file no // being there, not the actual delete. if (!Exists(filename)) { @@ -120,13 +120,13 @@ bool Delete(const std::string &filename) #ifdef _WIN32 if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) { - WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", + WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } #else if (unlink(filename.c_str()) == -1) { - WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", + WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } @@ -232,28 +232,28 @@ bool DeleteDir(const std::string &filename) return false; } -// renames file srcFilename to destFilename, returns true on success +// renames file srcFilename to destFilename, returns true on success bool Rename(const std::string &srcFilename, const std::string &destFilename) { - INFO_LOG(COMMON, "Rename: %s --> %s", + INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) return true; - ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", + ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } -// copies file srcFilename to destFilename, returns true on success +// copies file srcFilename to destFilename, returns true on success bool Copy(const std::string &srcFilename, const std::string &destFilename) { - INFO_LOG(COMMON, "Copy: %s --> %s", + INFO_LOG(COMMON, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str()); #ifdef _WIN32 if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) return true; - ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", + ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; #else @@ -267,7 +267,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) FILE *input = fopen(srcFilename.c_str(), "rb"); if (!input) { - ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", + ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } @@ -277,7 +277,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) if (!output) { fclose(input); - ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", + ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); return false; } @@ -291,8 +291,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) { if (ferror(input) != 0) { - ERROR_LOG(COMMON, - "Copy: failed reading from source, %s --> %s: %s", + ERROR_LOG(COMMON, + "Copy: failed reading from source, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } @@ -302,8 +302,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) int wnum = fwrite(buffer, sizeof(char), rnum, output); if (wnum != rnum) { - ERROR_LOG(COMMON, - "Copy: failed writing to output, %s --> %s: %s", + ERROR_LOG(COMMON, + "Copy: failed writing to output, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } @@ -335,7 +335,7 @@ u64 GetSize(const std::string &filename) WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str()); return 0; } - + struct stat64 buf; #ifdef _WIN32 if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) @@ -384,10 +384,10 @@ u64 GetSize(FILE *f) return size; } -// creates an empty file filename, returns true on success +// creates an empty file filename, returns true on success bool CreateEmptyFile(const std::string &filename) { - INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); + INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); if (!FileUtil::IOFile(filename, "wb")) { @@ -437,7 +437,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) #endif // check for "." and ".." if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || - ((virtualName[0] == '.') && (virtualName[1] == '.') && + ((virtualName[0] == '.') && (virtualName[1] == '.') && (virtualName[2] == '\0'))) continue; entry.virtualName = virtualName; @@ -452,14 +452,14 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) foundEntries += (u32)entry.size; } else - { // is a file + { // is a file entry.isDirectory = false; entry.size = GetSize(entry.physicalName.c_str()); } ++foundEntries; // Push into the tree - parentEntry.children.push_back(entry); -#ifdef _WIN32 + parentEntry.children.push_back(entry); +#ifdef _WIN32 } while (FindNextFile(hFind, &ffd) != 0); FindClose(hFind); #else @@ -504,7 +504,7 @@ bool DeleteDirRecursively(const std::string &directory) // check for "." and ".." if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || - ((virtualName[0] == '.') && (virtualName[1] == '.') && + ((virtualName[0] == '.') && (virtualName[1] == '.') && (virtualName[2] == '\0'))) continue; @@ -540,7 +540,7 @@ bool DeleteDirRecursively(const std::string &directory) closedir(dirp); #endif FileUtil::DeleteDir(directory); - + return true; } @@ -585,7 +585,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path) std::string GetCurrentDir() { char *dir; - // Get the current working directory (getcwd uses malloc) + // Get the current working directory (getcwd uses malloc) if (!(dir = __getcwd(NULL, 0))) { ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", @@ -604,7 +604,7 @@ bool SetCurrentDir(const std::string &directory) } #if defined(__APPLE__) -std::string GetBundleDirectory() +std::string GetBundleDirectory() { CFURLRef BundleRef; char AppBundlePath[MAXPATHLEN]; @@ -666,8 +666,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new if (FileUtil::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; else - paths[D_USER_IDX] = std::string(getenv("HOME") ? - getenv("HOME") : getenv("PWD") ? + paths[D_USER_IDX] = std::string(getenv("HOME") ? + getenv("HOME") : getenv("PWD") ? getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP; #endif @@ -749,7 +749,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; } } - + return paths[DirIDX]; } @@ -762,7 +762,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new // if (!FileUtil::Exists(dir)) // dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/"; //#endif -// +// // return dir; //} diff --git a/src/common/hash.cpp b/src/common/hash.cpp index d2ebc734..2ddcfe6b 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -115,15 +115,15 @@ inline u64 getblock(const u64 * p, int i) inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) { - k1 *= c1; - k1 = _rotl64(k1,23); + k1 *= c1; + k1 = _rotl64(k1,23); k1 *= c2; h1 ^= k1; h1 += h2; h2 = _rotl64(h2,41); - k2 *= c2; + k2 *= c2; k2 = _rotl64(k2,23); k2 *= c1; h2 ^= k2; @@ -250,7 +250,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) } -/* +/* * NOTE: This hash function is used for custom texture loading/dumping, so * it should not be changed, which would require all custom textures to be * recalculated for their new hash values. If the hashing function is @@ -273,7 +273,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u64 k = data[0]; data+=Step; k *= m; - k ^= k >> r; + k ^= k >> r; k *= m; h ^= k; h *= m; @@ -292,13 +292,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) case 1: h ^= u64(data2[0]); h *= m; }; - + h ^= h >> r; h *= m; h ^= h >> r; return h; -} +} #else // CRC32 hash using the SSE4.2 instruction u64 GetCRC32(const u8 *src, int len, u32 samples) @@ -351,15 +351,15 @@ inline u32 fmix32(u32 h) inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) { - k1 *= c1; - k1 = _rotl(k1,11); + k1 *= c1; + k1 = _rotl(k1,11); k1 *= c2; h1 ^= k1; h1 += h2; h2 = _rotl(h2,17); - k2 *= c2; + k2 *= c2; k2 = _rotl(k2,11); k2 *= c1; h2 ^= k2; @@ -405,7 +405,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) //---------- // tail - + const u8 * tail = (const u8*)(data + nblocks*8); u32 k1 = 0; @@ -439,7 +439,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) out[0] = h1; out[1] = h2; - + return *((u64 *)&out); } @@ -463,11 +463,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) { u64 k = data[0]; data+=Step; - k *= m; - k ^= k >> r; + k *= m; + k ^= k >> r; k *= m; h ^= k; - h *= m; + h *= m; } const u8 * data2 = (const u8*)end; @@ -483,7 +483,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) case 1: h ^= u64(data2[0]); h *= m; }; - + h ^= h >> r; h *= m; h ^= h >> r; diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h index 96dce315..f4263f72 100644 --- a/src/common/linear_disk_cache.h +++ b/src/common/linear_disk_cache.h @@ -64,7 +64,7 @@ public: m_file.seekg(0, std::ios::beg); std::fstream::pos_type start_pos = m_file.tellg(); std::streamoff file_size = end_pos - start_pos; - + if (m_file.is_open() && ValidateHeader()) { // good header, read some key/value pairs @@ -87,7 +87,7 @@ public: // read key/value and pass to reader if (Read(&key) && - Read(value, value_size) && + Read(value, value_size) && Read(&entry_number) && entry_number == m_num_entries+1) { @@ -115,7 +115,7 @@ public: WriteHeader(); return 0; } - + void Sync() { m_file.flush(); diff --git a/src/common/log.h b/src/common/log.h index 822cd21e..14ad98c0 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -11,7 +11,7 @@ enum { OS_LEVEL, // Printed by the emulated operating system NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports. - ERROR_LEVEL, // Critical errors + ERROR_LEVEL, // Critical errors WARNING_LEVEL, // Something is suspicious. INFO_LEVEL, // General information. DEBUG_LEVEL, // Detailed debugging - might make things slow. @@ -46,7 +46,7 @@ enum LOG_TYPE { MEMMAP, MEMCARD_MANAGER, OSREPORT, - PAD, + PAD, PROCESSORINTERFACE, PIXELENGINE, SERIALINTERFACE, @@ -89,7 +89,7 @@ enum LOG_LEVELS { } // namespace -void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line, +void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line, const char* function, const char* fmt, ...) #ifdef __GNUC__ __attribute__((format(printf, 6, 7))) diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp index 687f4e33..38c681ee 100644 --- a/src/common/log_manager.cpp +++ b/src/common/log_manager.cpp @@ -9,7 +9,7 @@ #include "common/timer.h" #include "common/thread.h" -void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, +void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, const char* function, const char* fmt, ...) { va_list args; @@ -112,7 +112,7 @@ LogManager::~LogManager() delete m_debuggerLog; } -void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, +void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, const char* function, const char *fmt, va_list args) { char temp[MAX_MSGLEN]; @@ -125,11 +125,11 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); static const char level_to_char[7] = "ONEWID"; - sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, + sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, level_to_char[(int)level], log->GetShortName(), function, temp); - + #ifdef ANDROID - Host_SysMessage(msg); + Host_SysMessage(msg); #endif log->Trigger(level, msg); } diff --git a/src/common/log_manager.h b/src/common/log_manager.h index de1d16ee..baefc4ba 100644 --- a/src/common/log_manager.h +++ b/src/common/log_manager.h @@ -54,7 +54,7 @@ class LogContainer { public: LogContainer(const char* shortName, const char* fullName, bool enable = false); - + const char* GetShortName() const { return m_shortName; } const char* GetFullName() const { return m_fullName; } @@ -98,7 +98,7 @@ public: static u32 GetMaxLevel() { return LogTypes::MAX_LOGLEVEL; } - void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, + void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, const char* function, const char *fmt, va_list args); void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) diff --git a/src/common/math_util.cpp b/src/common/math_util.cpp index ab0e6b75..3613e82a 100644 --- a/src/common/math_util.cpp +++ b/src/common/math_util.cpp @@ -18,7 +18,7 @@ u32 ClassifyDouble(double dvalue) value.d = dvalue; u64 sign = value.i & DOUBLE_SIGN; u64 exp = value.i & DOUBLE_EXP; - if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP) + if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP) { // Nice normalized number. return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; @@ -58,7 +58,7 @@ u32 ClassifyFloat(float fvalue) value.f = fvalue; u32 sign = value.i & FLOAT_SIGN; u32 exp = value.i & FLOAT_EXP; - if (exp > FLOAT_ZERO && exp < FLOAT_EXP) + if (exp > FLOAT_ZERO && exp < FLOAT_EXP) { // Nice normalized number. return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; @@ -77,13 +77,13 @@ u32 ClassifyFloat(float fvalue) // Denormalized number. return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD; } - } - else if (exp) + } + else if (exp) { // Infinite return sign ? PPC_FPCLASS_NINF : PPC_FPCLASS_PINF; - } - else + } + else { //Zero return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ; @@ -143,7 +143,7 @@ void Matrix33::RotateY(Matrix33 &mtx, float rad) mtx.data[0] = c; mtx.data[2] = s; mtx.data[4] = 1; - mtx.data[6] = -s; + mtx.data[6] = -s; mtx.data[8] = c; } diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp index 40d9c03a..31ca27b4 100644 --- a/src/common/mem_arena.cpp +++ b/src/common/mem_arena.cpp @@ -272,11 +272,11 @@ u8* MemArena::Find4GBBase() // yeah, this could also be done in like two bitwise ops... -#define SKIP(a_flags, b_flags) -// if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY)) -// continue; -// if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM)) -// continue; +#define SKIP(a_flags, b_flags) +// if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY)) +// continue; +// if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM)) +// continue; static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 flags, MemArena *arena) { // OK, we know where to find free space. Now grab it! diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index bab7d9f7..b6f66e4e 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -47,7 +47,7 @@ void* AllocateExecutableMemory(size_t size, bool low) // printf("Mapped executable memory at %p (size %ld)\n", ptr, // (unsigned long)size); - + #ifdef _WIN32 if (ptr == nullptr) { @@ -55,7 +55,7 @@ void* AllocateExecutableMemory(size_t size, bool low) if (ptr == MAP_FAILED) { ptr = nullptr; -#endif +#endif PanicAlert("Failed to allocate executable memory"); } #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) @@ -127,11 +127,11 @@ void FreeMemoryPages(void* ptr, size_t size) if (ptr) { #ifdef _WIN32 - + if (!VirtualFree(ptr, 0, MEM_RELEASE)) PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); ptr = NULL; // Is this our responsibility? - + #else munmap(ptr, size); #endif diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 7c5319ec..9bfdf950 100644 --- a/src/common/msg_handler.h +++ b/src/common/msg_handler.h @@ -15,7 +15,7 @@ enum MSG_TYPE CRITICAL }; -typedef bool (*MsgAlertHandler)(const char* caption, const char* text, +typedef bool (*MsgAlertHandler)(const char* caption, const char* text, bool yes_no, int Style); typedef std::string (*StringTranslator)(const char* text); @@ -31,29 +31,29 @@ void SetEnableAlert(bool enable); #ifndef GEKKO #ifdef _WIN32 - #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) - #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) - #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) - #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) - #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) + #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) + #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) + #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) + #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) + #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) // Use these macros (that do the same thing) if the message should be translated. - #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) - #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) - #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) - #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) - #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) + #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) + #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) + #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) + #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) + #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) #else - #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) - #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) - #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) - #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) - #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) + #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) + #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) + #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) + #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) + #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) // Use these macros (that do the same thing) if the message should be translated. - #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) - #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) - #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) - #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) - #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) + #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) + #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) + #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) + #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) + #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) #endif #else // GEKKO diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 54943d30..dcec9275 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -121,11 +121,11 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces) { std::ostringstream oss; oss << std::setfill('0') << std::hex; - + for (int line = 0; size; ++data, --size) { oss << std::setw(2) << (int)*data; - + if (line_len == ++line) { oss << '\n'; @@ -168,7 +168,7 @@ bool TryParse(const std::string &str, u32 *const output) errno = 0; unsigned long value = strtoul(str.c_str(), &endptr, 0); - + if (!endptr || *endptr) return false; @@ -294,7 +294,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st //#include //#include -const char HEX2DEC[256] = +const char HEX2DEC[256] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16, @@ -327,7 +327,7 @@ std::string UriDecode(const std::string & sSrc) const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; - const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' + const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' char * const pStart = new char[SRC_LEN]; char * pEnd = pStart; @@ -394,7 +394,7 @@ std::string UriEncode(const std::string & sSrc) for (; pSrc < SRC_END; ++pSrc) { - if (SAFE[*pSrc]) + if (SAFE[*pSrc]) *pEnd++ = *pSrc; else { @@ -518,9 +518,9 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& out_buffer.resize(out_buffer_size - dst_bytes); out_buffer.swap(result); - + iconv_close(conv_desc); - + return result; } @@ -576,7 +576,7 @@ std::u16string UTF8ToUTF16(const std::string& input) out_buffer.swap(result); iconv_close(conv_desc); - + return result; } diff --git a/src/common/string_util.h b/src/common/string_util.h index 787a5663..ae5bbada 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -63,7 +63,7 @@ template static bool TryParse(const std::string &str, N *const output) { std::istringstream iss(str); - + N tmp = 0; if (iss >> tmp) { diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index d61f4c0c..63ad6218 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp @@ -31,7 +31,7 @@ namespace Symbols { TSymbolsMap::iterator foundSymbolItr; TSymbol symbol; - + foundSymbolItr = g_symbols.find(_address); if (foundSymbolItr != g_symbols.end()) { @@ -44,7 +44,7 @@ namespace Symbols { return GetSymbol(_address).name; } - + void Remove(u32 _address) { g_symbols.erase(_address); diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 60d8ed07..dc153ba7 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -25,7 +25,7 @@ int CurrentThreadId() return 0; #endif } - + #ifdef _WIN32 void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) @@ -52,7 +52,7 @@ 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 void SetCurrentThreadName(const char* szThreadName) @@ -81,7 +81,7 @@ void SetCurrentThreadName(const char* szThreadName) __except(EXCEPTION_CONTINUE_EXECUTION) {} } - + #else // !WIN32, so must be POSIX threads void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) diff --git a/src/common/thread.h b/src/common/thread.h index 5e7bc1f9..be9b5cbe 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -30,7 +30,7 @@ int CurrentThreadId(); void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); void SetCurrentThreadAffinity(u32 mask); - + class Event { public: @@ -135,7 +135,7 @@ private: const size_t m_count; volatile size_t m_waiting; }; - + void SleepCurrentThread(int ms); void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms @@ -146,7 +146,7 @@ inline void YieldCPU() { std::this_thread::yield(); } - + void SetCurrentThreadName(const char *name); - + } // namespace Common diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 4a89572f..59efbce4 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project / PPSSPP Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once @@ -12,7 +12,7 @@ template struct ThreadQueueList { // Number of queues (number of priority levels starting at 0.) static const int NUM_QUEUES = 128; - + // Initial number of threads a single queue can handle. static const int INITIAL_CAPACITY = 32; -- cgit v1.2.3