From 94c68685a24a4bbef4e426df8a4e960e7bbfcd24 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 7 Jun 2018 18:25:52 -0700 Subject: [PATCH] Minor code review feedback --- DDSTextureLoader/DDSTextureLoader.cpp | 2 +- DDSTextureLoader/DDSTextureLoader12.cpp | 2 +- DirectXTex/scoped.h | 4 ++-- ScreenGrab/ScreenGrab.cpp | 2 +- ScreenGrab/ScreenGrab12.cpp | 2 +- Texassemble/texassemble.cpp | 2 +- Texconv/texconv.cpp | 2 +- Texdiag/texdiag.cpp | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DDSTextureLoader/DDSTextureLoader.cpp b/DDSTextureLoader/DDSTextureLoader.cpp index f4669f9..fcff7e6 100644 --- a/DDSTextureLoader/DDSTextureLoader.cpp +++ b/DDSTextureLoader/DDSTextureLoader.cpp @@ -121,7 +121,7 @@ namespace typedef std::unique_ptr ScopedHandle; - inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } template inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char (&name)[TNameLength]) diff --git a/DDSTextureLoader/DDSTextureLoader12.cpp b/DDSTextureLoader/DDSTextureLoader12.cpp index 79d85be..354018c 100644 --- a/DDSTextureLoader/DDSTextureLoader12.cpp +++ b/DDSTextureLoader/DDSTextureLoader12.cpp @@ -119,7 +119,7 @@ namespace typedef std::unique_ptr ScopedHandle; - inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } template inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) diff --git a/DirectXTex/scoped.h b/DirectXTex/scoped.h index 62715ec..548e2fd 100644 --- a/DirectXTex/scoped.h +++ b/DirectXTex/scoped.h @@ -25,7 +25,7 @@ struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VA typedef std::unique_ptr ScopedHandle; -inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } +inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } //--------------------------------------------------------------------------------- struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } }; @@ -51,7 +51,7 @@ public: } } - void clear() { m_handle = 0; } + void clear() { m_handle = nullptr; } private: HANDLE m_handle; diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 7205dfb..b9fa76f 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -197,7 +197,7 @@ namespace typedef std::unique_ptr ScopedHandle; - inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } class auto_delete_file { diff --git a/ScreenGrab/ScreenGrab12.cpp b/ScreenGrab/ScreenGrab12.cpp index 01028a0..5892e70 100644 --- a/ScreenGrab/ScreenGrab12.cpp +++ b/ScreenGrab/ScreenGrab12.cpp @@ -197,7 +197,7 @@ namespace typedef std::unique_ptr ScopedHandle; - inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } class auto_delete_file { diff --git a/Texassemble/texassemble.cpp b/Texassemble/texassemble.cpp index fda34fe..d491909 100644 --- a/Texassemble/texassemble.cpp +++ b/Texassemble/texassemble.cpp @@ -286,7 +286,7 @@ const SValue g_pExtFileTypes [] = namespace { - inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } }; diff --git a/Texconv/texconv.cpp b/Texconv/texconv.cpp index ca83a98..cf3fb50 100644 --- a/Texconv/texconv.cpp +++ b/Texconv/texconv.cpp @@ -428,7 +428,7 @@ const SValue g_pFeatureLevels[] = // valid feature levels for -fl for maximimu namespace { - inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } struct handle_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) CloseHandle(h); } }; diff --git a/Texdiag/texdiag.cpp b/Texdiag/texdiag.cpp index 9486733..e5cd0e0 100644 --- a/Texdiag/texdiag.cpp +++ b/Texdiag/texdiag.cpp @@ -355,7 +355,7 @@ const SValue g_pExtFileTypes[] = namespace { - inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; } + inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } struct find_closer { void operator()(HANDLE h) { assert(h != INVALID_HANDLE_VALUE); if (h) FindClose(h); } };