Move LTO-problematic definitions out of header

This commit is contained in:
Jack Andersen 2016-10-10 15:21:15 -10:00
parent 7f5ba744da
commit aa408ccfec
3 changed files with 44 additions and 32 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 51a097da6bf0c2b3f101aa922e2597eaed239c54
Subproject commit 1877c546acfe472a7220c4d26c28d74377d77146

View File

@ -415,42 +415,14 @@ static inline unsigned long StrToUl(const SystemChar* str, SystemChar** endPtr,
#if __GNUC__
__attribute__((__format__ (__printf__, 1, 2)))
#endif
static inline SystemString SysFormat(const SystemChar* format, ...)
{
SystemChar resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
#if HECL_UCS2
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
#else
int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va);
#endif
va_end(va);
return SystemString(resultBuf, printSz);
}
SystemString SysFormat(const SystemChar* format, ...);
#if __GNUC__
__attribute__((__format__ (__printf__, 1, 2)))
#endif
static inline std::string Format(const char* format, ...)
{
char resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va);
va_end(va);
return std::string(resultBuf, printSz);
}
std::string Format(const char* format, ...);
static inline std::wstring WideFormat(const wchar_t* format, ...)
{
wchar_t resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
va_end(va);
return std::wstring(resultBuf, printSz);
}
std::wstring WideFormat(const wchar_t* format, ...);
static inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz)

View File

@ -25,6 +25,46 @@ unsigned VerbosityLevel = 0;
logvisor::Module LogModule("hecl");
static const std::string Illegals {"<>?\"|"};
#if __GNUC__
__attribute__((__format__ (__printf__, 1, 2)))
#endif
SystemString SysFormat(const SystemChar* format, ...)
{
SystemChar resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
#if HECL_UCS2
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
#else
int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va);
#endif
va_end(va);
return SystemString(resultBuf, printSz);
}
#if __GNUC__
__attribute__((__format__ (__printf__, 1, 2)))
#endif
std::string Format(const char* format, ...)
{
char resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va);
va_end(va);
return std::string(resultBuf, printSz);
}
std::wstring WideFormat(const wchar_t* format, ...)
{
wchar_t resultBuf[FORMAT_BUF_SZ];
va_list va;
va_start(va, format);
int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va);
va_end(va);
return std::wstring(resultBuf, printSz);
}
void SanitizePath(std::string& path)
{
if (path.empty())