mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Make the RAII constructor explicit
This commit is contained in:
parent
25ae5a1284
commit
a5de2b33c0
@ -18,7 +18,7 @@ CComPtr<IPortableDeviceManager> wpd::portable_device_manager = NULL;
|
||||
// Flag indicating if COM has been initialized
|
||||
static int _com_initialized = 0;
|
||||
// Application Info
|
||||
wpd::ClientInfo wpd::client_info = {0};
|
||||
wpd::ClientInfo wpd::client_info;
|
||||
|
||||
// Module startup/shutdown {{{
|
||||
static PyObject *
|
||||
|
@ -34,11 +34,11 @@ class generic_raii {
|
||||
generic_raii & operator=( const generic_raii & ) ;
|
||||
|
||||
public:
|
||||
generic_raii(T h = null) : handle(h) {}
|
||||
explicit generic_raii(T h = null) : handle(h) {}
|
||||
~generic_raii() { release(); }
|
||||
|
||||
void release() {
|
||||
if (handle) {
|
||||
if (handle != null) {
|
||||
free_T(handle);
|
||||
handle = null;
|
||||
}
|
||||
@ -49,7 +49,6 @@ class generic_raii {
|
||||
void set_ptr(T val) { handle = val; }
|
||||
T* address() { return &handle; }
|
||||
explicit operator bool() const { return handle != null; }
|
||||
T operator->() { return handle; }
|
||||
};
|
||||
|
||||
typedef generic_raii<wchar_t*, PyMem_Free, NULL> wchar_raii;
|
||||
|
Loading…
x
Reference in New Issue
Block a user