Explicitly convert int to HANDLE to fix 64 bit wxMSW build.
This fixes g++ compilation problem in 64 bit mode after the changes of r76653, it complained about comparing pointer (HANDLE) with an integer. It might also fix compilation with icc. See #16233. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -189,9 +189,9 @@ template <int INVALID_VALUE = INVALID_HANDLE_VALUE>
|
||||
class AutoHANDLE
|
||||
{
|
||||
public:
|
||||
wxEXPLICIT AutoHANDLE(HANDLE handle = INVALID_VALUE) : m_handle(handle) { }
|
||||
wxEXPLICIT AutoHANDLE(HANDLE handle = InvalidHandle()) : m_handle(handle) { }
|
||||
|
||||
bool IsOk() const { return m_handle != INVALID_VALUE; }
|
||||
bool IsOk() const { return m_handle != InvalidHandle(); }
|
||||
operator HANDLE() const { return m_handle; }
|
||||
|
||||
~AutoHANDLE() { if ( IsOk() ) DoClose(); }
|
||||
@@ -202,10 +202,17 @@ public:
|
||||
|
||||
DoClose();
|
||||
|
||||
m_handle = INVALID_VALUE;
|
||||
m_handle = InvalidHandle();
|
||||
}
|
||||
|
||||
protected:
|
||||
// We need this helper function because integer INVALID_VALUE is not
|
||||
// implicitly convertible to HANDLE, which is a pointer.
|
||||
static HANDLE InvalidHandle()
|
||||
{
|
||||
return static_cast<HANDLE>(INVALID_VALUE);
|
||||
}
|
||||
|
||||
void DoClose()
|
||||
{
|
||||
if ( !::CloseHandle(m_handle) )
|
||||
|
Reference in New Issue
Block a user