diff options
| author | Per Larsson <[email protected]> | 2021-09-28 15:09:15 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-28 15:09:15 +0200 |
| commit | 141317786f9d59e95da8316ce40cf30e4dfd7b53 (patch) | |
| tree | 3c863384c6ca68a30e82989994408c5f40159273 /zencore/include | |
| parent | Removed using the bucket name to detect binary cache records and store conten... (diff) | |
| parent | apply: Re-enabled environment variable setup for child processes (diff) | |
| download | zen-141317786f9d59e95da8316ce40cf30e4dfd7b53.tar.xz zen-141317786f9d59e95da8316ce40cf30e4dfd7b53.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/compactbinaryvalue.h | 2 | ||||
| -rw-r--r-- | zencore/include/zencore/endian.h | 4 | ||||
| -rw-r--r-- | zencore/include/zencore/except.h | 6 | ||||
| -rw-r--r-- | zencore/include/zencore/filesystem.h | 10 | ||||
| -rw-r--r-- | zencore/include/zencore/intmath.h | 8 | ||||
| -rw-r--r-- | zencore/include/zencore/iobuffer.h | 8 | ||||
| -rw-r--r-- | zencore/include/zencore/logging.h | 60 | ||||
| -rw-r--r-- | zencore/include/zencore/mpscqueue.h | 2 | ||||
| -rw-r--r-- | zencore/include/zencore/zencore.h | 1 |
9 files changed, 58 insertions, 43 deletions
diff --git a/zencore/include/zencore/compactbinaryvalue.h b/zencore/include/zencore/compactbinaryvalue.h index 5795ef957..0124a8983 100644 --- a/zencore/include/zencore/compactbinaryvalue.h +++ b/zencore/include/zencore/compactbinaryvalue.h @@ -15,7 +15,7 @@ namespace CompactBinaryPrivate { template<typename T> static constexpr inline T ReadUnaligned(const void* const Memory) { -#if PLATFORM_SUPPORTS_UNALIGNED_LOADS +#if ZEN_PLATFORM_SUPPORTS_UNALIGNED_LOADS return *static_cast<const T*>(Memory); #else T Value; diff --git a/zencore/include/zencore/endian.h b/zencore/include/zencore/endian.h index d44a27b01..7a9e6b44c 100644 --- a/zencore/include/zencore/endian.h +++ b/zencore/include/zencore/endian.h @@ -2,6 +2,10 @@ #pragma once +#include "zencore.h" + +#include <cstdint> + namespace zen { inline uint16_t diff --git a/zencore/include/zencore/except.h b/zencore/include/zencore/except.h index 5cfefb1e2..e0e4aaae0 100644 --- a/zencore/include/zencore/except.h +++ b/zencore/include/zencore/except.h @@ -27,7 +27,7 @@ ZENCORE_API void ThrowLastError [[noreturn]] (std::string_view Message, const st ZENCORE_API void ThrowSystemError [[noreturn]] (uint32_t ErrorCode, std::string_view Message); ZENCORE_API std::string GetLastErrorAsString(); -ZENCORE_API std::string GetWindowsErrorAsString(uint32_t Win32ErrorCode); +ZENCORE_API std::string GetSystemErrorAsString(uint32_t Win32ErrorCode); inline int32_t GetLastError() @@ -40,9 +40,9 @@ GetLastError() } inline std::error_code -MakeWin32ErrorCode(uint32_t Win32ErrorCode) noexcept +MakeErrorCode(uint32_t ErrorCode) noexcept { - return std::error_code(Win32ErrorCode, std::system_category()); + return std::error_code(ErrorCode, std::system_category()); } inline std::error_code diff --git a/zencore/include/zencore/filesystem.h b/zencore/include/zencore/filesystem.h index 16d6ede53..6678528f6 100644 --- a/zencore/include/zencore/filesystem.h +++ b/zencore/include/zencore/filesystem.h @@ -66,13 +66,19 @@ class FileSystemTraversal public: struct TreeVisitor { - virtual void VisitFile(const std::filesystem::path& Parent, const std::wstring_view& File, uint64_t FileSize) = 0; + using path_view = std::basic_string_view<std::filesystem::path::value_type>; + + virtual void VisitFile(const std::filesystem::path& Parent, const path_view& File, uint64_t FileSize) = 0; // This should return true if we should recurse into the directory - virtual bool VisitDirectory(const std::filesystem::path& Parent, const std::wstring_view& DirectoryName) = 0; + virtual bool VisitDirectory(const std::filesystem::path& Parent, const path_view& DirectoryName) = 0; }; void TraverseFileSystem(const std::filesystem::path& RootDir, TreeVisitor& Visitor); }; +////////////////////////////////////////////////////////////////////////// + +void filesystem_forcelink(); // internal + } // namespace zen diff --git a/zencore/include/zencore/intmath.h b/zencore/include/zencore/intmath.h index b127c8993..7619e1950 100644 --- a/zencore/include/zencore/intmath.h +++ b/zencore/include/zencore/intmath.h @@ -21,7 +21,7 @@ _BitScanReverse(unsigned long* Index, uint32_t Mask) return 0; } - *Index = __builtin_clz(Mask); + *Index = 31 - __builtin_clz(Mask); return 1; } @@ -33,8 +33,8 @@ _BitScanReverse64(unsigned long* Index, uint64_t Mask) return 0; } - *Index = __builtin_clzll(Mask); - return 0; + *Index = 63 - __builtin_clzll(Mask); + return 1; } inline uint8_t @@ -46,7 +46,7 @@ _BitScanForward64(unsigned long* Index, uint64_t Mask) } *Index = __builtin_ctzll(Mask); - return 0; + return 1; } #endif diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h index 21751cd40..54801f9ac 100644 --- a/zencore/include/zencore/iobuffer.h +++ b/zencore/include/zencore/iobuffer.h @@ -7,6 +7,8 @@ #include "refcount.h" #include "zencore.h" +#include <filesystem> + namespace zen { struct IoHash; @@ -371,9 +373,11 @@ private: class IoBufferBuilder { + using path_char_t = std::filesystem::path::value_type; + public: - ZENCORE_API static IoBuffer MakeFromFile(const wchar_t* FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); - ZENCORE_API static IoBuffer MakeFromTemporaryFile(const wchar_t* FileName); + ZENCORE_API static IoBuffer MakeFromFile(const path_char_t* FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); + ZENCORE_API static IoBuffer MakeFromTemporaryFile(const path_char_t* FileName); ZENCORE_API static IoBuffer MakeFromFileHandle(void* FileHandle, uint64_t Offset = 0, uint64_t Size = ~0ull); inline static IoBuffer MakeCloneFromMemory(const void* Ptr, size_t Sz) { return IoBuffer(IoBuffer::Clone, Ptr, Sz); } }; diff --git a/zencore/include/zencore/logging.h b/zencore/include/zencore/logging.h index e98509bf8..0838cfe80 100644 --- a/zencore/include/zencore/logging.h +++ b/zencore/include/zencore/logging.h @@ -39,46 +39,46 @@ using zen::Log; // Helper macros for logging -#define ZEN_TRACE(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().trace(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_TRACE(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().trace(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_DEBUG(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().debug(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_DEBUG(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().debug(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_INFO(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().info(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_INFO(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().info(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_WARN(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().warn(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_WARN(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().warn(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_ERROR(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().error(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_ERROR(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().error(fmtstr##sv, ##__VA_ARGS__); \ } while (false) -#define ZEN_CRITICAL(fmtstr, ...) \ - do \ - { \ - using namespace std::literals; \ - Log().critical(fmtstr##sv, __VA_ARGS__); \ +#define ZEN_CRITICAL(fmtstr, ...) \ + do \ + { \ + using namespace std::literals; \ + Log().critical(fmtstr##sv, ##__VA_ARGS__); \ } while (false) #define ZEN_CONSOLE(fmtstr, ...) \ diff --git a/zencore/include/zencore/mpscqueue.h b/zencore/include/zencore/mpscqueue.h index bb558bb5a..e3359852a 100644 --- a/zencore/include/zencore/mpscqueue.h +++ b/zencore/include/zencore/mpscqueue.h @@ -24,7 +24,7 @@ struct TypeCompatibleStorage ElementType* Data() { return (ElementType*)this; } const ElementType* Data() const { return (const ElementType*)this; } - char alignas(ElementType) DataMember; + alignas(ElementType) char DataMember; }; /** Fast multi-producer/single-consumer unbounded concurrent queue. diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h index 4b9c1af1b..b5b47d076 100644 --- a/zencore/include/zencore/zencore.h +++ b/zencore/include/zencore/zencore.h @@ -198,6 +198,7 @@ ZENCORE_API bool IsPointerToStack(const void* ptr); // Query if pointer is with ZENCORE_API bool IsApplicationExitRequested(); ZENCORE_API void RequestApplicationExit(int ExitCode); ZENCORE_API bool IsDebuggerPresent(); +ZENCORE_API void SetIsInteractiveSession(bool Value); ZENCORE_API bool IsInteractiveSession(); ZENCORE_API void zencore_forcelinktests(); |