From 13d7f3e5d950ca6d3920af84e74adbe0fb4a8af7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 21 Apr 2021 08:30:31 +0530 Subject: [PATCH] Use & instead of address() --- src/calibre/devices/mtp/windows/device_enumeration.cpp | 4 ++-- src/calibre/utils/windows/common.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/mtp/windows/device_enumeration.cpp b/src/calibre/devices/mtp/windows/device_enumeration.cpp index a5f4da5072..6822af49ca 100644 --- a/src/calibre/devices/mtp/windows/device_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/device_enumeration.cpp @@ -339,9 +339,9 @@ get_device_information(CComPtr &device, IPortableDeviceProperti pyobject_raii storage(get_storage_info(device)); if (!storage) { pyobject_raii exc_type, exc_value, exc_tb; - PyErr_Fetch(exc_type.address(), exc_value.address(), exc_tb.address()); + PyErr_Fetch(&exc_type, &exc_value, &exc_tb); if (exc_type) { - PyErr_NormalizeException(exc_type.address(), exc_value.address(), exc_tb.address()); + PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb); PyDict_SetItemString(ans, "storage_error", exc_value.ptr()); } else { PyDict_SetItemString(ans, "storage_error", PyUnicode_FromString("get_storage_info() failed without an error set")); diff --git a/src/calibre/utils/windows/common.h b/src/calibre/utils/windows/common.h index ebcda47a80..872c163633 100644 --- a/src/calibre/utils/windows/common.h +++ b/src/calibre/utils/windows/common.h @@ -49,6 +49,7 @@ 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_raii;