From 55ebdf049f08d820094faf54ec6ef12355390d03 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 27 Jan 2023 17:49:10 +0530 Subject: [PATCH] Silence various warnings from clang --- .../devices/mtp/windows/content_enumeration.cpp | 15 +++++++-------- src/calibre/devices/mtp/windows/wpd.cpp | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index 729b6910c2..7c2e926585 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -188,7 +188,7 @@ private: public: GetBulkPropertiesCallback() : items(NULL), subfolders(NULL), level(0), complete(INVALID_HANDLE_VALUE), self_ref(0), callback(NULL) {} - ~GetBulkPropertiesCallback() { if (complete != INVALID_HANDLE_VALUE) CloseHandle(complete); complete = INVALID_HANDLE_VALUE; } + virtual ~GetBulkPropertiesCallback() { if (complete != INVALID_HANDLE_VALUE) CloseHandle(complete); complete = INVALID_HANDLE_VALUE; } bool start_processing(PyObject *items, PyObject *subfolders, unsigned int level, PyObject *callback) { complete = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -226,7 +226,7 @@ public: } return hr; } - HRESULT __stdcall GetBulkPropertiesCallback::OnProgress(REFGUID Context, IPortableDeviceValuesCollection* values) { + HRESULT __stdcall OnProgress(REFGUID Context, IPortableDeviceValuesCollection* values) { handle_values(values); return S_OK; } @@ -420,7 +420,6 @@ static IPortableDeviceValues* create_object_properties(const wchar_t *parent_id, const wchar_t *name, const GUID content_type, unsigned PY_LONG_LONG size) { // {{{ CComPtr values; HRESULT hr; - bool ok = false; prop_variant timestamp(VT_DATE); SYSTEMTIME systemtime; GetLocalTime(&systemtime); @@ -486,7 +485,7 @@ get_files_and_folders(unsigned int level, IPortableDevice *device, CComPtr content; HRESULT hr; @@ -503,7 +502,7 @@ wpd::get_filesystem(IPortableDevice *device, const wchar_t *storage_id, IPortabl } // }}} PyObject* -wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObject *dest, PyObject *callback) { // {{{ +get_file(IPortableDevice *device, const wchar_t *object_id, PyObject *dest, PyObject *callback) { // {{{ CComPtr content; CComPtr resources; CComPtr devprops; @@ -592,7 +591,7 @@ wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObject *dest, } // }}} PyObject* -wpd::create_folder(IPortableDevice *device, const wchar_t *parent_id, const wchar_t *name) { // {{{ +create_folder(IPortableDevice *device, const wchar_t *parent_id, const wchar_t *name) { // {{{ CComPtr content; CComPtr values; CComPtr devprops; @@ -623,7 +622,7 @@ wpd::create_folder(IPortableDevice *device, const wchar_t *parent_id, const wcha } // }}} PyObject* -wpd::delete_object(IPortableDevice *device, const wchar_t *object_id) { // {{{ +delete_object(IPortableDevice *device, const wchar_t *object_id) { // {{{ CComPtr content; CComPtr object_ids; HRESULT hr; @@ -656,7 +655,7 @@ wpd::delete_object(IPortableDevice *device, const wchar_t *object_id) { // {{{ } // }}} PyObject* -wpd::put_file(IPortableDevice *device, const wchar_t *parent_id, const wchar_t *name, PyObject *src, unsigned PY_LONG_LONG size, PyObject *callback) { // {{{ +put_file(IPortableDevice *device, const wchar_t *parent_id, const wchar_t *name, PyObject *src, unsigned PY_LONG_LONG size, PyObject *callback) { // {{{ CComPtr content; CComPtr values; CComPtr devprops; diff --git a/src/calibre/devices/mtp/windows/wpd.cpp b/src/calibre/devices/mtp/windows/wpd.cpp index 1cc90c3d50..ee1d98f83b 100644 --- a/src/calibre/devices/mtp/windows/wpd.cpp +++ b/src/calibre/devices/mtp/windows/wpd.cpp @@ -120,7 +120,7 @@ wpd_uninit(PyObject *self, PyObject *args) { // enumerate_devices() {{{ static PyObject * wpd_enumerate_devices(PyObject *self, PyObject *args) { - PyObject *refresh = NULL, *ans = NULL, *temp; + PyObject *ans = NULL, *temp; HRESULT hr; DWORD num_of_devices, i; PWSTR *pnp_device_ids;