mirror of
https://github.com/microsoft/DirectXTex
synced 2024-12-26 19:31:02 +00:00
Minor code review
This commit is contained in:
parent
20a685d62f
commit
ded992f48a
@ -16,21 +16,21 @@
|
|||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
struct aligned_deleter { void operator()(void* p) noexcept { _aligned_free(p); } };
|
struct aligned_deleter { void operator()(void* p) noexcept { _aligned_free(p); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<float[], aligned_deleter> ScopedAlignedArrayFloat;
|
using ScopedAlignedArrayFloat = std::unique_ptr<float[], aligned_deleter>;
|
||||||
|
|
||||||
typedef std::unique_ptr<DirectX::XMVECTOR[], aligned_deleter> ScopedAlignedArrayXMVECTOR;
|
using ScopedAlignedArrayXMVECTOR = std::unique_ptr<DirectX::XMVECTOR[], aligned_deleter>;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
struct handle_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
|
struct handle_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, handle_closer> ScopedHandle;
|
using ScopedHandle = std::unique_ptr<void, handle_closer>;
|
||||||
|
|
||||||
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
|
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
struct find_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
struct find_closer { void operator()(HANDLE h) noexcept { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, find_closer> ScopedFindHandle;
|
using ScopedFindHandle = std::unique_ptr<void, find_closer>;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
class auto_delete_file
|
class auto_delete_file
|
||||||
|
@ -298,7 +298,7 @@ namespace
|
|||||||
|
|
||||||
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, find_closer> ScopedFindHandle;
|
using ScopedFindHandle = std::unique_ptr<void, find_closer>;
|
||||||
|
|
||||||
#ifdef _PREFAST_
|
#ifdef _PREFAST_
|
||||||
#pragma prefast(disable : 26018, "Only used with static internal arrays")
|
#pragma prefast(disable : 26018, "Only used with static internal arrays")
|
||||||
|
@ -449,11 +449,11 @@ namespace
|
|||||||
|
|
||||||
struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
|
struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, handle_closer> ScopedHandle;
|
using ScopedHandle = std::unique_ptr<void, handle_closer>;
|
||||||
|
|
||||||
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, find_closer> ScopedFindHandle;
|
using ScopedFindHandle = std::unique_ptr<void, find_closer>;
|
||||||
|
|
||||||
inline static bool ispow2(size_t x)
|
inline static bool ispow2(size_t x)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@ namespace
|
|||||||
|
|
||||||
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };
|
||||||
|
|
||||||
typedef std::unique_ptr<void, find_closer> ScopedFindHandle;
|
using ScopedFindHandle = std::unique_ptr<void, find_closer>;
|
||||||
|
|
||||||
#ifdef _PREFAST_
|
#ifdef _PREFAST_
|
||||||
#pragma prefast(disable : 26018, "Only used with static internal arrays")
|
#pragma prefast(disable : 26018, "Only used with static internal arrays")
|
||||||
|
Loading…
Reference in New Issue
Block a user