|
|
@ -85,7 +85,6 @@ T* alignup(T* p) |
|
|
|
#define strlwr(psz) to_lower(psz) |
|
|
|
#define strlwr(psz) to_lower(psz) |
|
|
|
#define _strlwr(psz) to_lower(psz) |
|
|
|
#define _strlwr(psz) to_lower(psz) |
|
|
|
#define MAX_PATH 1024 |
|
|
|
#define MAX_PATH 1024 |
|
|
|
#define Beep(n1,n2) (0) |
|
|
|
|
|
|
|
inline void Sleep(int64 n) |
|
|
|
inline void Sleep(int64 n) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
|
|
|
|
/*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
|
|
|
@ -335,25 +334,6 @@ inline std::string HexStr(const std::vector<unsigned char>& vch, bool fSpaces=fa |
|
|
|
return HexStr(vch.begin(), vch.end(), fSpaces); |
|
|
|
return HexStr(vch.begin(), vch.end(), fSpaces); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> |
|
|
|
|
|
|
|
std::string HexNumStr(const T itbegin, const T itend, bool f0x=true) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (itbegin == itend) |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
const unsigned char* pbegin = (const unsigned char*)&itbegin[0]; |
|
|
|
|
|
|
|
const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]); |
|
|
|
|
|
|
|
std::string str = (f0x ? "0x" : ""); |
|
|
|
|
|
|
|
str.reserve(str.size() + (pend-pbegin) * 2); |
|
|
|
|
|
|
|
for (const unsigned char* p = pend-1; p >= pbegin; p--) |
|
|
|
|
|
|
|
str += strprintf("%02x", *p); |
|
|
|
|
|
|
|
return str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string HexNumStr(const std::vector<unsigned char>& vch, bool f0x=true) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return HexNumStr(vch.begin(), vch.end(), f0x); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T> |
|
|
|
template<typename T> |
|
|
|
void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSpaces=true) |
|
|
|
void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSpaces=true) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -475,21 +455,6 @@ bool SoftSetBoolArg(const std::string& strArg, bool fValue); |
|
|
|
} \ |
|
|
|
} \ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define CATCH_PRINT_EXCEPTION(pszFn) \ |
|
|
|
|
|
|
|
catch (std::exception& e) { \ |
|
|
|
|
|
|
|
PrintException(&e, (pszFn)); \ |
|
|
|
|
|
|
|
} catch (...) { \ |
|
|
|
|
|
|
|
PrintException(NULL, (pszFn)); \ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T1> |
|
|
|
template<typename T1> |
|
|
|
inline uint256 Hash(const T1 pbegin, const T1 pend) |
|
|
|
inline uint256 Hash(const T1 pbegin, const T1 pend) |
|
|
@ -689,11 +654,6 @@ inline void SetThreadPriority(int nPriority) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline bool TerminateThread(pthread_t hthread, unsigned int nExitCode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return (pthread_cancel(hthread) == 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void ExitThread(size_t nExitCode) |
|
|
|
inline void ExitThread(size_t nExitCode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pthread_exit((void*)nExitCode); |
|
|
|
pthread_exit((void*)nExitCode); |
|
|
|