From 3e5c70e6b473626163da8f16df7ab3d5dfa61728 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 2 Aug 2024 12:15:15 -0500 Subject: [PATCH] refactor --- repertory/librepertory/include/common.hpp | 65 +++++++++++++++-------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/repertory/librepertory/include/common.hpp b/repertory/librepertory/include/common.hpp index 7322839e..23c96c41 100644 --- a/repertory/librepertory/include/common.hpp +++ b/repertory/librepertory/include/common.hpp @@ -173,8 +173,6 @@ inline constexpr const auto NANOS_PER_SECOND = 1000000000L; #endif #endif -#define WINFSP_ALLOCATION_UNIT UINT64(4096U) - #if defined(_WIN32) #define UTIME_NOW ((1l << 30) - 1l) #define UTIME_OMIT ((1l << 30) - 2l) @@ -193,6 +191,8 @@ using UINT64 = std::uint64_t; using VOID = void; using WCHAR = wchar_t; +#define WINFSP_ALLOCATION_UNIT UINT64(4096U) + #define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_SYSTEM 0x00000004 @@ -226,32 +226,51 @@ using WCHAR = wchar_t; #define GENERIC_EXECUTE (0x20000000L) #define GENERIC_ALL (0x10000000L) -#define INVALID_FILE_ATTRIBUTES ((DWORD) - 1) +#define INVALID_FILE_ATTRIBUTES static_cast(-1) #define MAX_PATH 260 -#define STATUS_SUCCESS std::int32_t(0) -#define STATUS_ACCESS_DENIED std::int32_t(0xC0000022L) -#define STATUS_DEVICE_BUSY std::int32_t(0x80000011L) -#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::int32_t(0xC0000468L) -#define STATUS_DIRECTORY_NOT_EMPTY std::int32_t(0xC0000101L) -#define STATUS_FILE_IS_A_DIRECTORY std::int32_t(0xC00000BAL) -#define STATUS_FILE_TOO_LARGE std::int32_t(0xC0000904L) -#define STATUS_INSUFFICIENT_RESOURCES std::int32_t(0xC000009AL) -#define STATUS_INTERNAL_ERROR std::int32_t(0xC00000E5L) -#define STATUS_INVALID_ADDRESS std::int32_t(0xC0000141L) -#define STATUS_INVALID_HANDLE std::int32_t(0xC0000006L) -#define STATUS_INVALID_IMAGE_FORMAT std::int32_t(0xC000007BL) -#define STATUS_INVALID_PARAMETER std::int32_t(0xC000000DL) -#define STATUS_NO_MEMORY std::int32_t(0xC0000017L) -#define STATUS_NOT_IMPLEMENTED std::int32_t(0xC0000002L) -#define STATUS_OBJECT_NAME_EXISTS std::int32_t(0x40000000L) -#define STATUS_OBJECT_NAME_NOT_FOUND std::int32_t(0xC0000034L) -#define STATUS_OBJECT_PATH_INVALID std::int32_t(0xC0000039L) -#define STATUS_UNEXPECTED_IO_ERROR std::int32_t(0xC00000E9L) +#define STATUS_SUCCESS \ + std::int32_t { 0 } +#define STATUS_ACCESS_DENIED \ + std::int32_t { 0xC0000022L } +#define STATUS_DEVICE_BUSY \ + std::int32_t { 0x80000011L } +#define STATUS_DEVICE_INSUFFICIENT_RESOURCES \ + std::int32_t { 0xC0000468L } +#define STATUS_DIRECTORY_NOT_EMPTY \ + std::int32_t { 0xC0000101L } +#define STATUS_FILE_IS_A_DIRECTORY \ + std::int32_t { 0xC00000BAL } +#define STATUS_FILE_TOO_LARGE \ + std::int32_t { 0xC0000904L } +#define STATUS_INSUFFICIENT_RESOURCES \ + std::int32_t { 0xC000009AL } +#define STATUS_INTERNAL_ERROR \ + std::int32_t { 0xC00000E5L } +#define STATUS_INVALID_ADDRESS \ + std::int32_t { 0xC0000141L } +#define STATUS_INVALID_HANDLE \ + std::int32_t { 0xC0000006L } +#define STATUS_INVALID_IMAGE_FORMAT \ + std::int32_t { 0xC000007BL } +#define STATUS_INVALID_PARAMETER \ + std::int32_t { 0xC000000DL } +#define STATUS_NO_MEMORY \ + std::int32_t { 0xC0000017L } +#define STATUS_NOT_IMPLEMENTED \ + std::int32_t { 0xC0000002L } +#define STATUS_OBJECT_NAME_EXISTS \ + std::int32_t { 0x40000000L } +#define STATUS_OBJECT_NAME_NOT_FOUND \ + std::int32_t { 0xC0000034L } +#define STATUS_OBJECT_PATH_INVALID \ + std::int32_t { 0xC0000039L } +#define STATUS_UNEXPECTED_IO_ERROR \ + std::int32_t { 0xC00000E9L } #define CONVERT_STATUS_NOT_IMPLEMENTED(e) \ - ((std::int32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e) + ((std::int32_t{e} == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e) namespace Fsp::FileSystemBase { enum {