From b15117ce2bdca1c9d66065fb6d28b5af955d4a66 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 30 Apr 2021 07:30:12 +0530 Subject: [PATCH] Fix building on windows 32bit --- src/calibre/devices/mtp/windows/content_enumeration.cpp | 2 +- src/calibre/devices/mtp/windows/device_enumeration.cpp | 2 +- src/calibre/utils/windows/common.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index 78fee8c14d..4046abcbd5 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -326,7 +326,7 @@ find_objects_in(CComPtr &content, CComPtr child_ids; + generic_raii_array child_ids; Py_BEGIN_ALLOW_THREADS; hr = children->Next((ULONG)child_ids.size(), child_ids.ptr(), &fetched); Py_END_ALLOW_THREADS; diff --git a/src/calibre/devices/mtp/windows/device_enumeration.cpp b/src/calibre/devices/mtp/windows/device_enumeration.cpp index addf854730..69d5db24b2 100644 --- a/src/calibre/devices/mtp/windows/device_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/device_enumeration.cpp @@ -85,7 +85,7 @@ get_storage_info(IPortableDevice *device) { // {{{ hr = S_OK; while (hr == S_OK) { - generic_raii_array object_ids; + generic_raii_array object_ids; Py_BEGIN_ALLOW_THREADS; hr = objects->Next((ULONG)object_ids.size(), object_ids.ptr(), &fetched); Py_END_ALLOW_THREADS; diff --git a/src/calibre/utils/windows/common.h b/src/calibre/utils/windows/common.h index eccfd6e255..9c776fc258 100644 --- a/src/calibre/utils/windows/common.h +++ b/src/calibre/utils/windows/common.h @@ -24,7 +24,8 @@ set_error_from_hresult(PyObject *exc_type, const char *file, const int line, con } #define error_from_hresult(hr, ...) set_error_from_hresult(PyExc_OSError, __FILE__, __LINE__, hr, __VA_ARGS__) -typedef generic_raii com_wchar_raii; +static inline void co_task_mem_free(void* m) { CoTaskMemFree(m); } +typedef generic_raii com_wchar_raii; static inline void handle_destructor(HANDLE p) { CloseHandle(p); } typedef generic_raii handle_raii;