mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Make MSVC happy
This commit is contained in:
parent
31fe61569f
commit
fb95b532bd
@ -555,7 +555,7 @@ wpd::get_file(IPortableDevice *device, const wchar_t *object_id, PyObject *dest,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_raii<char*, PyMem_Free> buf(reinterpret_cast<char*>(PyMem_Malloc(bufsize)));
|
generic_raii<char*, pymem_free> buf(reinterpret_cast<char*>(PyMem_Malloc(bufsize)));
|
||||||
if (!buf) return PyErr_NoMemory();
|
if (!buf) return PyErr_NoMemory();
|
||||||
|
|
||||||
while (total_read < filesize) {
|
while (total_read < filesize) {
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
#include <Objbase.h>
|
#include <objbase.h>
|
||||||
#include <PortableDeviceApi.h>
|
#include <PortableDeviceApi.h>
|
||||||
#include <PortableDevice.h>
|
#include <PortableDevice.h>
|
||||||
#include "../../../utils/windows/common.h"
|
#include "../../../utils/windows/common.h"
|
||||||
|
@ -47,13 +47,14 @@ class generic_raii {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void wchar_raii_free(wchar_t *x) { PyMem_Free(x); }
|
template<typename T>
|
||||||
|
static inline void pymem_free(T *x) { PyMem_Free(x); }
|
||||||
|
|
||||||
#if (defined(__GNUC__) && !defined(__clang__))
|
#if (defined(__GNUC__) && !defined(__clang__))
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
|
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
|
||||||
#endif
|
#endif
|
||||||
class wchar_raii : public generic_raii<wchar_t*, wchar_raii_free, static_cast<wchar_t*>(NULL)> {
|
class wchar_raii : public generic_raii<wchar_t*, pymem_free> {
|
||||||
#if (defined(__GNUC__) && !defined(__clang__))
|
#if (defined(__GNUC__) && !defined(__clang__))
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,7 +58,8 @@ class scoped_com_initializer { // {{{
|
|||||||
|
|
||||||
#define INITIALIZE_COM_IN_FUNCTION scoped_com_initializer com; if (!com) return com.set_python_error();
|
#define INITIALIZE_COM_IN_FUNCTION scoped_com_initializer com; if (!com) return com.set_python_error();
|
||||||
|
|
||||||
static inline void co_task_mem_free(wchar_t *x) { CoTaskMemFree(x); }
|
template<typename T>
|
||||||
|
static inline void co_task_mem_free(T *x) { CoTaskMemFree(x); }
|
||||||
typedef generic_raii<wchar_t*, co_task_mem_free> com_wchar_raii;
|
typedef generic_raii<wchar_t*, co_task_mem_free> com_wchar_raii;
|
||||||
|
|
||||||
static inline void mapping_raii_free(void *x) { UnmapViewOfFile(x); }
|
static inline void mapping_raii_free(void *x) { UnmapViewOfFile(x); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user